Graphics Reference
In-Depth Information
Of course, we can also use the shorthand:
sym.getSymbol("OuterSymbol")
.getSymbol("InnerSymbol")
.play();
If you are already inside a symbol and want to access the parent symbol, you
can do so with the following expression:
// Reference to the parent symbol
sym.getParentSymbol();
If, for example, you are within an intro symbol and want to play the parent
Timeline at the end of the Timeline through a trigger action, the action looks
like this:
sym.getParentSymbol().play();
However, with the getParentSymbol() function you can only go one level
higher, relative to the current Timeline. Of course, you can nest this function
however you want, since it returns a symbol, but you should avoid the following
code cascade for functions such as accessing the Stage:
var stage = sym.getParentSymbol().getParentSymbol();
Not only does this quickly create “spaghetti code,” it makes it very difficult to
restructure your composition. If an affected symbol must be moved into a new
symbol, all paths are no longer valid, which in turn creates the need for extra
testing and adjustments. For such cases, the Edge Animate API offers an absolute
means to access the Stage. You must first determine the actual composition that
contains the symbol. This is necessary because multiple stages and their child
elements can exist on a page. The function sym.getComposition() allows us
to access the composition from within each symbol. The returned composition
object makes the getStage() function available, with which we obtain the
reference to the current Stage. Thus, for example, with the following action, we
can play all levels of our composition from the film symbol, which is located
directly on the Stage.
sym.getComposition()
.getStage()
.getSymbol("Film")
.play();
 
Search WWH ::




Custom Search