Flash CS3 – Adding Code to Buttons using Action Script 2.0

Posted: May 23, 2013 in Adobe Flash, Tutorial
Tags: , ,

This tutorial will help with the use of basic buttons to allow for interactivity.

  • Start by opening Flash and then the movies you have buttons on that you want to be able to use to open other Flash files.

     

  • Click on Your button and give it a name, eg Volcano_btn. NOTE: the _btn indicates that it is a button, not a Graphic or MovieClip symbol.

 

  • Now it is time to use the Action Script layer you made in your Flash movies.

    NOTE: I frequently refer to, and name, this layer Actions for short……

 

  • Now add the code:

    Volcano_btn.onRelease = function(){

        loadMovie(“VolcanoStory.swf”, _root.blank_mc);

    }

 

  • Now you can press CTRL+ENTER to make (compile) the SWF file.

     

  • Now start your Container page and see if it works.

NOTE: When a button is used in a Container styled situation like this it needs to be tested from the Container file itself. The _root. part of the code is the indicator of this method.

 

 

EXTENSION:

Now use this information to make the buttons in your other Flash files load the Map back into the Blank_mc.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s