Δευτέρα 23 Μαρτίου 2009

Flash Action Script 2.0 - onPress

Take the First movie that you made in tutorial of Motion tween and get make it Stop, and play.

Now Open it and Start

1. Go  to your time line menu and insert a new layer


Name it Action

2.   Now press f9 or go to Window -> Actions


Go to 1st frame of your Action layer and write in Actions panel

stop();


If you press CTRL+ENTER to test your movie you will see that the clip it doesn’t move

3. Let’s make a button 2 make the movie move again. Create a new layer above Actions and layer 1 and name it button. To take it in the middle you just drag it to the middle

    

     4.      Now get the Rectangle tool (R) and make a rectangle on that position

    

    5.       Select the new rectangle and press f8 to convert into a symbol and press button. Name it Button_bt

    

    6.       Now Select the Button_bt and go to Properties panel and give it for Instance name Button_bt

      

    

      It’s a glorius simasia the name that to be right because with this name you call your movie to do something.

      7.   After that go to Action layer in the first frame, open the Action panel and write under the stop();

     

     Button_bt.onPress = function(){

gotoAndPlay(2);

}

This is mean Button_bt - the name of your button (now you call your button to do something)

onPress - when someone press it

function - do something

gotoAndPlay(2) - your movie go to frame 2 and play



    You can Download The source files from here


Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου