Unit 12.  Buttons (III)


Actions in the buttons

Since the existence of multitude of actions that can be applied to the buttons, as well as to other elements of Flash 8 we are going to comment two of the most common ones:

1) Opening a Web page. With this we’ll be able to open any Internet page (or a Flash movie), which will be used to browse through webs which contain more than one page, or to allow the user to download files among other things.

 

For adding an action to a button is necessary the ActionScript use (in Unit 17 it will be treated deeper).

So the steps to follow are:

  1. Select the button clicking on it. So it's the button where the action is associated to.
  2. Open the Action Panel clicking on its tab or through the menu Window → Actions.
  3. Click on the Script Assist button.
  4. On the left, select Global Functions → Browser/Network → getURL.
  5. When selecting the getURL command (which is the one that opens a link in a window browser), its respective options will be displayed on the right. Fill the URL field with the page you want to open and select in which window you want the link to be opened (_blank will open the link in a new window).
  6. Close the Action Panel and the button will be ready. You have added an action to your button.

 

Here you have a sample of how to do it.

And this is the result:

 

2) Controlling a movie under way. If we are reproducing a Flash movie and we want to allow the user to stop it, start it, play it, and play it back .... 

    For example, to stop a movie we must make our button on the stage of the movie, select it, and open the actions panel, then activate the Stop() function.

    After doing this, we would have to change, as we made in the previous animation, the moment at which the function must be executed, selecting the event on Press.

We show above how the panel of the button actions would look like.  

Now whenever we press this button the movie will be stopped.

In a similar way we would act doing so but with other control actions.

Adding sound to a button

 

  If our pages are going to have sound, the sound in the buttons is a fundamental part. For example, we can make the sounds to become activated when pressing a button.

     For this, we must simply edit our button and select the frame Down. Now we must insert the sound. For example we could import one from our hard disk or take some that we already have in the library.

The result could be something like this:

 

  Exercises of the Unit 12                                                           Unit 12 Test.

 


 
   
Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited.
January-2006.