Graphics Reference
In-Depth Information
// The symbol object icon can be used to call
// symbol functions such as play stop
var mySymbolObject = sym.getSymbol("Symbol1");
The call sym.getSymbol(SYMBOLNAME) is the reference to the symbol,
which in this case is a child element of the current Timeline or current symbol.
Remember that the current symbol may be the Stage itself. The return value is
also a symbol reference. If the symbol contains more symbols, you can use the
getSymbol() function again to go into a deeper symbol level. Suppose we
have the following symbol composition:
Figure 5.15
The inner life of a symbol
We are on the Stage and want to reference the OuterSymbol to play its
Timeline. This is done as follows:
var myOuterSym = sym.getSymbol(“OuterSymbol”);
myOuterSym.play();
Since the function getSymbol() returns a symbol reference, we can also use
the following shorthand, as long as we do not reuse the reference in another
action:
sym.getSymbol("OuterSymbol").play();
However, if we want to start the nested red animation, which is additionally
embedded in the InnerSymbol symbol, the code is as follows:
var myOuterSym = sym.getSymbol("OuterSymbol");
var myInnerSym = myOuterSym.getSymbol("InnerSymbol");
myInnerSym.play();
 
Search WWH ::




Custom Search