views:

49

answers:

1

I have an application I am attempting to convert from a flex 3 air application to a flex 4 air application.

I am running into an issue in my main class. When calling the Instance method on the class I am getting an error:

Access of possibly undefined property Instance through a reference with static type Class.

My main class is pretty complex but the problem could be broken down to a simple example.

MyClass.mxml

<mx:WindowedApplication>
  <mx:Script>
    private static var instance:MyClass = null;

    public static function get Instance():MyClass {
      return instance;
    }
  </mx:Script>
  <mx:Canvas></mx:Canvas>
</mx:WindowedApplication>

For some reason when calling MyClass.Instance in another file I get the above error.

The Outline window in flash builder does not show the static methods of this class, and typing MyClass into a code window the code completion does not show any of my static methods being accessible.

Is there another place I need to define static members outside of the mx:Script bock?

+1  A: 

The simple answer is that it is no-longer mx:Script, the namespace for the Script attribute is now fx:Script.

stats