The following example shows how you can determine when a Flash ActionScript 3.0 UILoader component has been resized by listening for the resize event (using the static Event.RESIZE constant).
Full code after the jump.
// ActionScript 3.0 /* Requires: * - UILoader component in Flash library */ import fl.containers.UILoader; var uiLoader:UILoader = new UILoader(); uiLoader.scaleContent = false; uiLoader.addEventListener(Event.RESIZE, uiLoader_resize); uiLoader.source = "http://www.helpexamples.com/flash/images/image1.jpg"; addChild(uiLoader); function uiLoader_resize(evt:Event):void { var newX:uint = uint((stage.stageWidth - uiLoader.width) / 2); var newY:uint = uint((stage.stageHeight - uiLoader.height) / 2); uiLoader.move(newX, newY); }
{ 0 comments… add one now }