views:

38

answers:

2

Here is the error I get:

1046: Type was not found or was not a compile-time constant: fbAPI.

Here is my MXML:

<?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
          creationComplete="startGame();">

  <mx:Script>
    <![CDATA[
      import fbAPI;
      public function startGame():void {
        var fbAPI:fbAPI = new fbAPI();   // breaks on this line
        fbAPI.fbLogin();
      }           
    ]]>
  </mx:Script>
</mx:Application>

And here is my fbAPI.as stub that doesn't seem to get imported:

package {
  public class fbAPI {
    import mx.controls.Alert;
    public function fbLogin():void {
     Alert.show('test');
    }
  }
}
+1  A: 

Edit: nevermind, I forgot in AS3 you don't need a constructor.

Make sure you put the fbAPI.as file in the same location as your mxml file.

Dave Wolfe
Thats what I was thinking Dave
CodeJustin.com
+1  A: 

Try putting your import statements above your class and also just rename the instance name of the fbapi in your mxml real quick.

CodeJustin.com
The second half did the trick. I had renamed it earlier in a funky way I guess, and this corrected that.
Andrew Johnson