Tween Animation
Posted by Aditya Dutta | | Posted On Saturday, September 5, 2009 at 1:05 AM
This tutorial could additionally be a tutorial about how to accomplish a chic application accumulation ActionScript and aspect from the library. This simple button will accept two states, over and out. And the alteration amid the two accompaniment will be a fade. So in adjustment to do this we will alpha in the Flash assembly apparatus (Flash CS3).
So aboriginal you will appetite to actualize a fresh symbol, so appropriate bang on your library in Flash CS3 and accept fresh symbol. In the window that will open, name your fresh attribute “simpleButton” and in the bond area bang the consign for ActionScript option. The catchy allotment is next. It will automatically ample the Chic and the Base Chic field. The Chic acreage is ok, what we appetite to change is the Base Chic field. Since we are activity to use ActionScript Tweens for animation, we don’t charge the timeline. So our Base Chic will not be MovieClip, but Sprite. So instead of “flash.display.MovieClip”, address “flash.display.Sprite” in the Base Chic field. Now every affair should be fine, bang “ok”.
Now we are central our simpleButton. We appetite to accomplish 4 layers for this button, so on the timeline actualize 4 layers and rename them like this starting from the lower one: “back”, “Over”, “Label”, “LabelOver”. On the band “back” actualize a rectangle application the cartoon tool. On the band “Over” archetype the antecedent rectangle, but change its color. This blush will be the blush the button changes to aback you cycle over it. Now appropriate bang on the additional rectangle and catechumen it to symbol. On the abutting window, name it whatever you want, but bang the consign for ActionScript option. We will appetite to change the Base Chic to Sprite also, so do as we did earlier. Bang ok to abutting the window. Now bang on the fresh Sprite you created and in the acreage ambassador at the bottom, in the Blush baddest box accept Alpha, and accord it an Alpha of 0%.
We created the aback of the button, now we accept to actualize the label. On the third band “Label”, actualize a activating textfield over the rectangles you created earlier. Accord it an instance name “myLabel”. Accept the chantry you want, accord it a atramentous color, accomplish it not selectable and bury the characters you appetite for that font. Now archetype that textfield at the aforementioned abode but on the band called “LabelOver”, change its instance name to”myLabelOver” and additionally change its blush so that we may see a change aback we cycle over the button. We are now done with what we accept to do application Flash CS3. Basically, we accept a fresh attribute with for layers in it; 2 rectangles and 2 textfields. Now lets do some ActionScript.
Now accomplish a fresh ActionScript 3 certificate and save it as simpleButon.as in the aforementioned binder than your fla file. Here is the cipher you charge to accomplish it work.