Proportional Scale
April 20th, 2009
Well how do i scale my objects proportionally? Hmm this is a problem, but now a problem resolved. Now you can use the scaleObject class, a simple class that make only one thing: scale objects proportionally.
This is great to maximize images into the fullscreen stage or other things when you need create nicelly thumbnails, i used this class into the drag large images with zoom post, when the picture is loaded i put the code to contract the image size into the mask moviclip. Now i will explane some thing about it, look the simple code:
1 2 | import com.dLibs.utils.scaleObject; var so:scaleObject = new scaleObject(movieClip, { width : stage.stageWidth, height : stage.stageHeight }); |
Really simple? Yeah. You will need only create a scaleObject and into the constructor arguments put the movieclip or bitmap object that you want scale and into the second argument, the object, you put the min width and min height of your object or the stage, width and height receive numbers.
2 | var soTwo:scaleObject = new scaleObject(bitmap, { width : 500, height : 400 }); |
If the bitmap or movieclip have more width than height will show full height and hide the extra width.
You can download the scaleObject class using Google Code or with the link bellow.
Download: scaleObject class (203)





April 20th, 2009 at 16:45
[...] Scale VA:F [1.1.7_509]please wait…Rating: 0.0/5 (0 votes cast) This article was found on . Click here to visit the full article on the original website.Well how do i scale my objects proportionally? Hmm this is a problem, but now a problem resolved. [...]
April 23rd, 2009 at 20:05
Hello,
Thank you! I would now go on this blog every day!
Saurooon
June 20th, 2009 at 18:14
/*
Are you forgot KISS principle?
You can responds to any stage resize event by proportionally scaling the image to fill the stage. Since scaleX and scaleY are percentages, it’s just a matter of figuring out which property is larger and making the two equal. By swapping the scale comparison from “greater than” to “less than”, the object will scale proportionally to fit the larger of the two dimensions given. This kind of calculation is handy when you need to fit items of variable dimensions into a fixed space
*/
// set image dimensions to match stage;
image.width = stage.stageWidth;
image.height = stage.stageHeight;
// choose the larger scale property and match the other to it;
( image.scaleX < image.scaleY ) ? image.scaleY = image.scaleX : image.scaleX = image.scaleY;
December 18th, 2009 at 17:21
Hey – I stumbled on your page by mistake. I was looking in Google for beach suggestions for my trip when I came upon your site, I have to say your site is really informative, I just love the theme, its amazing!. I don’t have the time at the moment to fully read your site but I have bookmarked it and also signed up for your RSS feeds. I’ll back around in a day or two. thanks for a nice site.
March 9th, 2010 at 09:27
Can i use this blog post as a reference. I am thinking to create my post out of this and give my own insight.. I hope you don’t mind
March 11th, 2010 at 19:55
Cam i use this blog post as a reference. I am thinking to create my post out of this and give my own insight.. I hope you don't mind;
March 22nd, 2010 at 12:13
i would like to hear more on this topic please