jarretttowe
jarretttowe

Reputation: 21

Actionscript ExternalInterface syntax error

I have created a simple container app whose purpose is to:

  1. play an embedded flv by clicking a button onscreen

  2. activate an external interface call (this records the fact that the person has watched the video)

That's it.

I have it working partially. I have a button on scene 1 with the "click and go to next scene" code snippet attached to it. I click it and it happily moves on to scene 2 where the flv video plays beautifully. The problem happens when I try to insert the code that the external developer told me to use to make the connection between my flash file and IT's back end work.

Here is the recommended code:

ExternalInterface.call("recordScore()”);

Unfortunately, as soon as I enter this code, there is a syntax error and the movie no longer plays. I added the code on a frame at the end of the movie.

I am no sure that the syntax the developer sent was correct, nor do I know where to insert this code into the proper place.

Upvotes: 2

Views: 51

Answers (2)

Jason Sturges
Jason Sturges

Reputation: 15955

It looks like there is a closed double quotes (”) in what you pasted:

ExternalInterface.call("recordScore()”);

Assure quotation marks, and you do not need the () on the JavaScript function you're calling:

ExternalInterface.call("recordScore");

When running from Flash Projector (as in Ctrl+Enter), you can test whether External Interface is available; otherwise, an exception is thrown at runtime:

if (ExternalInterface.available) {
    ExternalInterface.call("recordScore");
}

Upvotes: 2

jarretttowe
jarretttowe

Reputation: 21

Fortunately, I found some code in the former employee's files that seems to have worked:

ExternalInterface.call ( "recordScore()" );

Hopefully this will connect with the database and resolve the issue so I can go back to making videos.

Thank you so much for your help! Regards!

Upvotes: 0

Related Questions