package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
/**
* ...
* @author DefaultUser (Tools -> Custom Arguments...)
*/
public class Main extends Sprite
{
public var damy:Bitmap = new Bitmap();
public function pushed(e:MouseEvent):void
{
trace("pushed!");
}
public function comp(e:Event):void
{
trace("comp");
damy.addEventListener(MouseEvent.CLICK, pushed);
addChild(damy);
}
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
//画像の読み込み処理。読み込まれたらcomp関数が呼ばれる
var ml:MyLoader = new MyLoader();
ml.fLoadGraph("damy.PNG", damy);
ml.fAddEventListener(comp);
ml.fStart();
}
}
}
public function comp(e:Event):void
{
trace("comp");
var s:Sprite = new Sprite();
s.addChild(damy);
addChild(s);
s.addEventListener(MouseEvent.CLICK, pushed);
}