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

Chapter 9. Controlling Information Flow > Concatenating Variables and Dynamic R...

Concatenating Variables and Dynamic Referencing

The addition operator (+) adds the values of numeric data types. But it can also put together string data types. The expression "Hello" + "world", for example, results in the string "Hello world". This kind of operation is called concatenation. You can even mix strings, numbers, and variables to create expressions that create new objects or variables dynamically. For example, a common practice for naming duplicate movie-clip instances is to concatenate a variable with the name of the original movie clip. The variable is simply a counter that increases by 1 each time a duplicate is made. If the movie-clip name is mushroom, and the variable name is counter, you can concatenate a new name with the following expression:

"mushroom" + counter 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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