Actionscript 3 Adobe动画椋鸟错误
我已经使用starling框架在adobe animate中创建了hungryherogame(recreate)。。 从以下地址下载: ()Actionscript 3 Adobe动画椋鸟错误,actionscript-3,starling-framework,adobe-animate,Actionscript 3,Starling Framework,Adobe Animate,我已经使用starling框架在adobe animate中创建了hungryherogame(recreate)。。 从以下地址下载: () 它通过静态类型类的引用从位图调用一个可能未定义的方法时出错-->首先看,一切正常!根据fromBitmap是starling.textures.Texture 但问题是因为导入flash.display3D.textures.Texture在您的帖子中超出了代码块,让我绞死了几分钟 所以在这个例子中,我们有相同的类名,两个纹理。编译器也会混淆(不明确的引
它通过静态类型类的引用从位图调用一个可能未定义的方法时出错-->首先看,一切正常!根据
fromBitmap
是starling.textures.Texture
但问题是因为导入flash.display3D.textures.Texture
在您的帖子中超出了代码块,让我绞死了几分钟
所以在这个例子中,我们有相同的类名,两个纹理。编译器也会混淆(不明确的引用错误)
试试看
编辑
为了让编译器明白,你的意思是什么纹理
暗示
我想你真的不需要导入flash.display3D.textures.Texture代码>
因此,将其从默认代码中删除(在不将纹理
更改为starling.textures.Texture
的情况下,问题已得到解决)请提供一些代码,确保没有人不会下载该RAR文件,所以这个问题只有在你发布生成错误信息的那部分代码后才能解决。会这样做的,兄弟:)好的,谢谢:),而且否决票不是我的,不幸的是,这里不允许说波斯语,但在chat.stackoverflow.com.permission bro.哦,别介意你是肯定的:)。我的部分代码已添加到我的帖子中。请检查并帮助我to@Mohammadtavakoly我们必须将所有纹理更改为starling.Textures.Texture,我现在就编辑我的答案?我们将它添加到类中,并从两个超级类starling.textures扩展而来@Mohammadtavakoly你试过我编辑的代码吗?另请阅读其他建议,这是另一个答案(与第一部分无关)@Mohammadtavakoly如果您需要更多讨论,请在您>20岁时加入此处s@Mohammadtavakoly很好,所以这个答案已经解决了,应该被接受,但是对于你的新问题,把它作为一个新问题发布,不幸的是,我不熟悉starling框架和stage3d。
package {
import flash.display3D.textures.Texture;
import flash.utils.Dictionary;
import flash.display.Bitmap;
import starling.textures.Texture;
import starling.display.Sprite;
import starling.events.Event;
import starling.display.Image;
import starling.display.Button;
import starling.core.Starling;
import starling.events.Event;
import screens.Welcome;
public class Assets {
[Embed(source = "media/graphics/bgWelcome.jpg")]
public static const BgWelcome: Class;
[Embed(source = "media/graphics/welcome_hero.png")]
public static const WelcomeHero: Class;
[Embed(source = "media/graphics/welcome_title.png")]
public static const WelcomeTitle: Class;
[Embed(source = "media/graphics/welcome_playButton.png")]
public static const WelcomePlayBtn: Class;
[Embed(source = "media/graphics/welcome_aboutButton.png")]
public static const WelcomeAboutBtn: Class;
private static var gameTextures: Dictionary = new Dictionary();
public static function getTexture(name: String): Texture {
if (gameTextures[name] == undefined) {
var bitmap: Bitmap = new Assets[name]();
gameTextures[name] = Texture.fromBitmap(bitmap);
}
return gameTextures[name];
}
}
}
public static function getTexture(name: String): starling.textures.Texture {
if (gameTextures[name] == undefined) {
var bitmap: Bitmap = new Assets[name]();
gameTextures[name] = starling.textures.Texture.fromBitmap(bitmap);
}
return gameTextures[name];
}