我正在尝试开始使用名为 FlashDevelop 的 Flash IDE,它不使用我习惯的 .FLA 编辑器。我已经找到了如何将 /lib 文件夹中的文件嵌入到项目中,但我不确定如何像我之前所做的那样,将嵌入文件(例如 .jpg)与 .as 文件相关联以提供说明关于如何行动。下面是代表我尝试弄清楚的代码,在此先感谢您的帮助。
package
{
import flash.display.Bitmap;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
[Frame(factoryClass="Preloader")] //This references an auto generated preloader which I haven't touched
public class Main extends Sprite
{
[Embed(source="../lib/index.jpg")]
public var logo:Class; //I'm attempting to connect the image in the above line to my logo.as file, all that's in there is an empty constructor and a simple update method that moves the image to the right
public var pic:logo;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
pic:logo = new logo();
addChild(pic);
addEventListener(Event.ENTER_FRAME, update);
}
private function update(e:Event):void
{
pic.update();
}
}
}