我使用 Starling 框架在 adobe animate 中创建了饥饿英雄游戏(重新创建)。从以下地址下载:
( http://www.test.farsvila.ir/animate_starling_Error.rar )
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];
}
}
}
它犯了一个错误->通过具有静态类型Class的引用从Bitmap调用可能未定义的方法。