我有一个问题要在其容器中居中动画。
这是容器或装载机:
public function Main():void
{
trace("Constructor...");
this.addEventListener(Event.ADDED_TO_STAGE, this.addEvent);
}
public function addEvent(e:Event):void
{
trace("AddedToStage");
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
var url = new URLRequest("testfile.swf");
movie = new Loader();
movie.contentLoaderInfo.addEventListener(Event.COMPLETE, this.eventComplete);
this.stage.addChild(movie);
movie.load(url);
}
public function eventComplete(e:Event):void
{
trace("Complete...");
movie.x = (this.stage.stageWidth - movie.width) * 0.5;
movie.y = (this.stage.stageHeight - movie.height) * 0.5;
}
这适用于场景中的对象,但不适用于添加了动作脚本的对象......就像这样:
public function Main():void
{
trace("Constructor of included file!");
stage.scaleMode = StageScaleMode.NO_SCALE;
var movieclip = new symbol_an();
stage.addChild(movieclip);
}
你有解决方案吗?
谢谢,问候。