Writing Actionscript in Flash


In this tutorial I will explain the pattern of writing Actionscript in Flash with actionscript 2.0.



A. Pattern writing actionscript in button

1. Create a new text object on the stage by using the Text Tool (T).


2. The next phase of the object change into a button  by pressing F8 or select the convert to the Symbol (right-click on the stage).





3. Select OK.
4. Click the button object and press F9 to active the area of actionscript, type the following script.

   on(release){
        trace("hellow world")
     }
5. CTRL+Enter, to see the results of the above program.
B. Pattern writing actionscript in MovieClip

How to write actionscript on a Movieclip :

1. Create a object into the actionscript.

2. Change the object to the movieclip (F8).



3. OK
4. Click the movieclip and press F9. Type the following script :

  onClipEvent(enterFrame){
       _x+=3;//move right
   }

5. CTRL+Enter to see the result.


C. Pattern writing actionscript on Frame

Example :

1. Create a movieclip.
2. And instance name is "ball"
3. Next, click frame 1 and press F9. Type the following script :

   ball.onEnterFrame = function(){
        this._x+=3;

      }

4. And running program, press CTRL+Enter.

Share this

Related Posts

Previous
Next Post »