• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Controlling Information Flow > Using Variables and Expressions

Using Variables and Expressions

Use variables and expressions as placeholders for parameters within your ActionScript. In virtually every action or method that requires you to enter a parameter, you can place a variable or an expression instead of a fixed value. For example, you can enter an expression instead of a frame number for the parameter for the basic action gotoAndStop. This expression might be a variable called myCard that holds a number from 1 to 52. Frames 1 through 52 in the Timeline could contain graphics of the 52 playing cards, so changing the variable myCard in the gotoAndStop action would make Flash display different cards.

The parameter in the action getURL can be an expression rather than a fixed Internet address. The expression might be a string concatenated with a variable such as "http://"+yourWebSite. Changing the variable called yourWebSite makes Flash load different URLs with the getURL action.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint