Share Posted September 5, 2009 Hey is there an easy way to lock the width and height ratio? I'm trying to set the width of the mc equal to the stage but have the height keep to scale also. So the wider I open my stage the taller the mc gets also. :S Thanks in advance. sizeXListener = new Object(); sizeXListener.onResize = resizerX; Stage.addListener(sizeXListener); function resizerX() { TweenLite.to(main,0,{_width:Math.floor(Stage.width)}); } resizerX(); Link to comment Share on other sites More sharing options...
Share Posted September 5, 2009 Sure, you'd just need to do the math: var ratio:Number = main.height / main.width; function resizerX() { var w:Number = Math.floor(Stage.width); TweenLite.to(main,0,{_width:w, _height:w * ratio}); } Link to comment Share on other sites More sharing options...
Author Share Posted October 9, 2009 Thanks a lot. I found an article on it but your solution is ten times shorter. Your brain must be really heavy. 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