Search code examples
flashactionscript-3actionscriptdocument-class

accessing an instance reference to the document class from the stage's timeline


Is there a way to get an instance reference to the document class to call a method of it from the stage's timeline?
I see that here's a possible solution: using a singleton
Other solution I though of is using stage.getChildAt( 0 ) but it's not very nice.
Is there an 'official' instance reference? because the document class is obviously instantiated at startup, but is that instance accessible in any way without having to use a custom solution like the ones mentioned?
Thanks.


Solution

  • All attached DisplayObject instances have a root property. Cast this to your document class. Bingo.