Return to Snippet

Revision: 33642
at October 11, 2010 20:18 by Empreintes


Initial Code
var el:MovieClip = new MovieClip;

el.addEventListener(Event.ADDED_TO_STAGE,center);

private function center(evt:Event):void{
	evt.target.x = (stage.stageWidth - evt.target.width)/2;
	evt.target.y = (stage.stageHeight - evt.target.height)/2;
}

Initial URL

                                

Initial Description
just a basic center function

Initial Title
Center a left-top corner based element in stage

Initial Tags

                                

Initial Language
ActionScript 3