Graphics Reference
In-Depth Information
The value to be set (VALUE) can be of any type; thus, you may use values such
as integers, symbol instances, or arrays in this way:
// Set integer
sym.setVariable( "score", 123 );
// Set the symbol instance
sym.setVariable( "introSym", sym.getSymbol("intro") );
// Set array
sym.setVariable( "users", [user1, user2, user3] );
If you define (in the Library) a symbol that has individual parameters (that will
be evaluated when an instance is created for the symbol that influences the dis-
play), symbol variables are always a good choice. Techniques such as how to set
the display location of a map symbol in this manner are covered in section 7.3.
5.5.9 The sym Argument
Since nearly all actions use the sym argument of the enclosing function, it is im-
portant to understand this variable. It always returns a reference to the symbol
of the currently open Timeline, which may initially seem a bit confusing when
dealing with symbols. Suppose you have created a symbol and placed it on the
Stage. This means you are still on the Timeline of the Stage itself. If you now add
the click event to the symbol with a right-click and use the sym references
within the action, it refers to the Stage itself and not the selected symbol.
Thus, the following action within a click event handler of a symbol starts
playing its parent Timeline:
// Play parent Timeline (e.g. stage)
// of symbol
sym.play();
If you instead want to play the Timeline of the symbol itself, the action must
be as follows:
// Play inner Timeline of symbol
sym.getSymbol("mySymbol").play();
 
Search WWH ::




Custom Search