/ Published in: ActionScript 3
just a basic center function
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }