A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Referencing the stage issue

  1. #1
    Join Date
    Jul 2008

    Referencing the stage issue


    I am currently working with a contractor company that is hosting a flex based website. They are putting the swf files that I have developed into their flex site.

    The issue that I am having is that within my swf file I need to reference the stage. I do this by "MovieClip(parent).stage"... I do not use the keyword "root", I just reference my swf's root through however many "parent"s i need. It works fine when I publish on my own, outside of their flex site. When it is used in the flex site, they are getting an error that they cannot reference the stage/ stage is null. It is vital that I am able to reference the stage of my swf.

    Please help.

    thanks in advance!


  2. #2
    Join Date
    Apr 2003
    How are they using it? It sounds like the swf/movieclip isn't attached to the stage..
    My DeviantART gallery of drawings and games.

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Austin, TX
    You are probably referencing the stage during the constructor, or otherwise before the swf is necessarily on the display list. When running as the document class, stage is set from the beginning. But when loading into another swf, the stage property does not get set until the new swf is actually added to the displayList. Use a listener for ADDED_TO_STAGE to make sure that the stage is valid before using it.

    Also, MovieClip(parent).stage gives you the same thing as just using stage. There's no need to go to the parent. And even if there were, the parent property is typed as DisplayObject container so there's no need to cast to MovieClip since DisplayObject container has a stage property.

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