1 Reply Latest reply on Oct 7, 2007 11:02 PM by kglad

    How to access stage instance from constructor?

    mgoodes
      I have some frame code that looks like this:

      var mc = new myClass();
      addChild( mc );
      // Try to access mc.stage here, no problem

      Inside myClass it looks like this:

      package {
      class myClass {
      function myClass() {
      // try to access "stage" here, it comes up null!
      }}}

      So how can I access the stage in the constructor instead of in the frame code? I want to add event listeners to the stage and would rather do it from within the class constructor than in the frame code. Doing this in the frame code will just lead to sloppiness as the application develops.

      Thanks.