Link to home
Start Free TrialLog in
Avatar of formi
formiFlag for Switzerland

asked on

as 3.0: calling js-function

Hi

I found many instructions how to use ExternalInterface.call in as 3.0 but it doesn't work. In the html-page where I embed my Flash I have the following code:
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta http-equiv="expires" content="3">

<script type="text/javascript">
function myJsFunc(url) {
	alert(URL)
}

</script>


<script language="JavaScript" type="text/javascript">
<!--
//v1.7
// Flash Player Version Detection
// Detect Client Browser type ............

Open in new window

In AS I call it
import flash.external.ExternalInterface; 
ExternalInterface.call("myJsFunc","just an example");

Open in new window

but nothing happens.
Avatar of Rob
Rob
Flag of Australia image

the ExternalInterface (ie the html page) may not be available yet (hasn't fully loaded) so you need to check it:

if (ExternalInterface.available) {
import flash.external.ExternalInterface;
ExternalInterface.call("myJsFunc","just an example");
}
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial