Hey Harsath24330...
To increase the size is pretty simple. We could do it a few ways.
1) Immediate Resize
Code:
btn_mc.onRelease = function() {
resize_mc._width = new width
resize_mc._height = new height
}
This will immediately resize the target mc (resize_mc) when the button (button_mc) is clicked. There will be no tweening or easing, etc...
2) Ease/Tween Animation
There are a lot of tweening engines out there -- Fuse, mcTween, Tweener, Zigo, MX Tween/Ease Class, etc...
Use whichever you are familiar with. My personal favorite is mcTween. With mcTween, you wold do this.
Code:
btn_mc.onRelease = function() {
resize_mc.xScaleTo(200, 1, "easeOutQuad")
resize_mc.yScaleTo(200, 1, "easeOutQuad")
}
Note: Make sure you've included the mc_tween2.as file -- #include "mc_tween2.as"
Sytax: [movieclip].xScaleTo(scalePercentage, time(seconds), tweeningAnimation)
You can find more on mcTween here: hosted.zeh.com.br/mctween/
If you would rather use actual values for the size, use the Tween/Ease class that ships with Flash MX 2004 and above...
Code:
btn_mc.onRelease = function() {
new Tween(resize_mc, "_width", Regular.easeOut, resize_mc._width, new width, 3, true);
new Tween(resize_mc, "_height", Regular.easeOut, resize_mc._height, new height, 3, true);
}
Note: Make sure to import the Tweening and easing classes-- import mx.transitions.Tween; import mx.transitions.easing.*;
Syntax: new Teen([tagetMC], "_property", "tweenAnimation", "startValue", "endValue", "time (frames/seconds), "useSeconds (true/false)")
There is a nice tutorial on the Tweening/Easing classes here: http://www.kirupa.com/developer/actionscript/tween.htm
For your benefit, I've color coded the AS. Everything in red needs new values (i.e. those of your MC and of your preferences). Everything in blue needs to be renamed to your movieclips. If you have any other questions, feel free to post back.
Bookmarks