learn more...Time: 15 Minutes. Purpose: Samples & Introduction Before you start: Please download the source files: Animated_Button.fla and TweeningEngine.mxp. Using the Tweening Engine: For a starters, install the “TweeningEngine.mxp” extension (you just have to double-click on it and it will lead you to the Extension Manager). You will have to open/reopen Flash. Create a new document. Set the frame rate to 35. From now on there will be only a bit of coding to be done, but you shouldn’t worry, it will end with a fine animation after exactly 6 lines. The first two are used to import the tweening classes and the flash transition/easing class and they should be inserted in the Actions window of the first frame inside “MyButton” movie clip. import xtd.tweening.*; We got to the part when we should animate the button. The code bellow is going to scale FoB as to shrink it, the textColoring will change the color of out text and the BackShadow will make the button drop shadow. var StripShrink = new Tween(FoB, "_yscale", Bounce.easeOut, 95, 0, 10, false); As you can see there were used three types of Tweens each very simple to understand having to mention the instance of the movie clip it refers to, the property the tween will change, the easing type, the starting value, the ending value, the duration and if the tween starts automatically or not. As we have chosen “false” for the “autostart” property, the tweens will start when having the mouse over:
this.onRollOver = function() {
StripShrink.start();
BackShadow.start();
textColoring.start();
};
this.onRollOut = function() {
StripShrink.reverse(Regular.easeIn);
BackShadow.reverse(Regular.easeOut);
textColoring.reverse(Regular.easeOut);
};
When the mouse is no longer on our button the tweens will be reversed with different easing functions. Closing To summarize all that I have achieved through this simple animation I should begin by reminding you that with 6 code lines in 15 minutes or less, without any timeline modification there was created a button animation. Thank you for reading this tutorial and hope you will find useful this tutorial, and the tool I’ve used to make the animated button. |
||||||
Disclaimer
1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. link to this article |