0
votes

I know very little about Flash, but I need to be able to call a JS function from inside a ActionScript file.

When I enter the line:

ExternalInterface.call("alert", "test");

I get the error:

There is no method with the name 'ExternalInterface'.

In the tutorials it seems I have to include the namespace:

import flash.external.ExternalInterface;

but I don't know where to put that?

I place it outside the class that extends a mediaclip and it does nothing.

How do I include that reference so that the ExternalInterface method is recognized?

What's odd is that intellisense works and allows me to type it in and gives me the overloaded methods, so it knows what I'm trying to say, it just doesn't work when I try to compile it.

1
Show us the code that includes the import statement, it's not possible to say what exactly is wrong without that. - Sunil D.
The source is from a OnGuard Online Game: Web - onguardonline.gov/media/game-0011-phishing-scams Download - onguardonline.gov/sites/default/files/phishing_game_source.zip Specifically, the UserProgress.as, line 74 - after they get a point I want to fire a JS Alert message - GideonKain
It's usually best to post the code you're actually using. Why should I go look at that tutorial? I would guess that their code probably works :) importing classes is pretty fundamental, so you probably just have it in the wrong place or something simple like that. - Sunil D.
The actual code I'm using IS that source, it's about 8 .as files and 3 .fla files, all I want to do is add one line of code to that source and compile it. - GideonKain

1 Answers

1
votes

You could also try access the class doing this:

flash.external.ExternalInterface.call("alert", "test");

That way you don't have to import the package with the class.