3 Replies Latest reply on Jul 31, 2007 5:42 PM by Newsgroup_User

    Accessing the stage variable problems in AS 3.0

    SamDonaldson
      Hi. Quick question...I'm trying to access the stage variable which I believe is supposed to be global and I should be able to access it from any class. Is this true? The compiler is complaining that it doesn't recognize this variable? Note that these objects have not been added to the stage yet but still, these are compile time errors, so why is that I'm getting these errors?

      Thanks,

      Sam
        • 1. Re: Accessing the stage variable problems in AS 3.0
          Level 7
          Sam,

          > I'm trying to access the stage variable which I believe is
          > supposed to be global and I should be able to access it
          > from any class.

          If this is related to your swf?var=value question, check back in your
          other thread (and please accept my apologies). I steered you the wrong way
          last time.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Accessing the stage variable problems in AS 3.0
            SamDonaldson Level 1
            Actually, this doesn't have to do with that question. Basically, the compiler is complaining that it doesn't recognize the stage variable. This is weird because in my AS 3.0 book, I see that the stage variable is being accessed without instantiating it or retrieving it. Would you happen to know what's going on here? Is it because it doesn't recognize it in a package? These are just wild guesses. I am extending Sprite in all my classes. My main class extends MovieClip since I have a fla associated with it. Thanks.
            • 3. Re: Accessing the stage variable problems in AS 3.0
              Level 7
              Sam,

              > Actually, this doesn't have to do with that question.
              > Basically, the compiler is complaining that it doesn't
              > recognize the stage variable.

              It complains about the DisplayObject.stage property? Are you
              referencing it in conjunction with a DisplayObject instance?

              > This is weird because in my AS 3.0 book, I see that
              > the stage variable is being accessed without instantiating
              > it or retrieving it.

              What book is that? I might have it, then I can see what you're seeing.

              > I am extending Sprite in all my classes.

              Yeah, Sprite extends DisplayObject, by of InteractiveObject, then
              DisplayObjectContainer, so it certainly is entitled to the stage property.
              Let me know what book you're looking at, and if I don't have it (and if
              you're still interested), I'll try to recreate a simplified proof of concept
              on this end.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."