Hi,
I have a question to center an animation within its container.
This is the container or loader:
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;
}
This work perfectly with the objects that are on the scene, but not with objects that are added with actionscript... like this:
public function Main():void
{
trace("Constructor of included file!");
stage.scaleMode = StageScaleMode.NO_SCALE;
var movieclip = new symbol_an();
stage.addChild(movieclip);
}
Do you have a solution?
Thank you, regards.