Share Posted November 15, 2010 Hi, I have a problem with AutoFitArea when the stage scale mode mode is set to NO_SCALE. Even though I added stage resize listener, the area doesn't respond to it at all - doesn't change its size I have the latest package, downloaded today so that's not the libraries issue. Here's my code import flash.display.Loader; import flash.net.URLRequest; import flash.events.Event; import flash.display.StageScaleMode; import flash.display.StageAlign; import com.greensock.layout.*; /*** These two lines below make the problem, but I need to disable stage resizing, so the other objects don't scale ***/ stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; addEventListener(Event.RESIZE, stageResize); var l:Loader = new Loader(); l.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded); l.load(new URLRequest("myImage.jpg")); var area:AutoFitArea = new AutoFitArea(this, 0, 0, stage.stageWidth, stage.stageHeight); area.preview = true; area.addEventListener(Event.CHANGE, areaChanged); function onLoaded(e:Event):void { /*var bmp:Bitmap = Bitmap(l.content); bmp.smoothing = true;*/ addChild(l); area.attach(l, ScaleMode.PROPORTIONAL_INSIDE, AlignMode.CENTER, AlignMode.CENTER); } function stageResize(e:Event):void { /*** These just don't work at all ***/ area.width = stage.stageWidth; area.height = stage.stageHeight; area.update(); } function areaChanged(e:Event):void { trace("area changed"); } Anyone could help? I'm compiling the file under Flash CS5 Link to comment Share on other sites More sharing options...
Author Share Posted November 15, 2010 OMG! I was so stupid and forgot to add the event listener to the stage stage.addEventListener(Event.RESIZE, stageResize); Now it works as it should Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now