FlashDevelop not importing flash packages

40 Views Asked by At

When I trying to import ExternalInterface:

import flash.external.*;

class Main 
{
    
    public static function main(swfRoot:MovieClip):Void 
    {
        System.security.allowDomain("*");
        ExternalInterface.addCallback("abc", _global.ChatMessage);
    }
    
    public function Main() 
    {
    }
    
}

I get this error: Unknown variable ExternalInterface However, I imported it. What is the problem?

1

There are 1 best solutions below

0
Adam Harte On

There are a few things to try when getting an error like that.

First check your spelling. Often it can be a simple typo causing all your issues.

Next, try importing the Class explicitly, rather than using a package wildcard. so...

import flash.external.ExternalInterface;

You should also wrap any usage of the externalInterface class in check if ExternalInterface.available.