A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] What is the relation between root and the document class?

Hybrid View

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    88

    resolved [RESOLVED] What is the relation between root and the document class?

    How are they related?

    Are they the same?

    Is using "MovieClip(root)." from anywhere actually equivalent to coding in the document class?

    What's different in their effect on the display list?

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The root will be an instance of the document class.

    Code:
    MovieClip(root);
    Is equivalent in most cases, however the root does not need to be a MovieClip. And in contexts without a root property, or the root property is null, that won't work. Also, you can add things so that the root of that object does not point to the main timeline root, but to a root in its own context. This usually is because you've added something to the stage instead of under the root.

    As far as effect on the display list, there is no difference in the effect on the display list, unless you create one. The root is an instance of DisplayObject, so any class which extends DisplayObject could technically be the root. But if you choose something that isn't also a DisplayObjectContainer (like Shape), then you cannot add children. If you choose something that is not a MovieClip, then you cannot have frame code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center