How to set a global variable in as2

Written by alexander gokhfeld
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to set a global variable in as2
ActionScript helps to add interactive features to Flash movies. (Jupiterimages/Photos.com/Getty Images)

ActionScript 2 (AS2) variables store values for use in the Flash movie scripts. They can contain any type of data. There are three scopes of AS variables: timeline, global or local. Global variables are accessible from anywhere in your movie currently loaded into the Flash Player. You can set the variable in one frame, and it will hold its contents in another frame. You need to assign a value to the variable to set a global variable in AS2 script.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Click the "Start" button and select "Macromedia Flash MX" to open the Flash MX application.

  2. 2

    Click "File" and "Open." Open your ActionScript panel and select the ActionScript where you want to set the global variable.

  3. 3

    Add the following code after the "function" line in your ActionScript to create the "traceSlide" global variable and assign it the value 5:

    _global.traceSlide=5;

  4. 4

    Add the following code after "end" line in your ActionScript to assign a global variable to the "sequence" function:

    sequence (_global.traceSlide);

  5. 5

    Click "File" and "Save" to save your global variable in your ActionScript.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.