I am trying to use ExternalInterface with my AS3.0 app to pass data back to my HTML page upon the completion of a video. I manage to get this working on Chrome, but with Microsoft Edge it just doesn’t happen.
Im trying to write a webpage that integrates with a flash file I made. I managed to get it working with chrome, but with Edge the feature doesn’t work. The flash file uses a method to call a JavaScript function that is supposed to change the style of two divs, but it just doesn’t work on edge…
<script>
function JsTestFunction(myFlashValue) {
document.getElementById("flashContent").style.display = "none";
document.getElementById("fiveContent").style.display = "block";
}
</script>
This part is the flash part, it works with chrome
import flash.external.ExternalInterface; // by querying the LoaderInfo object, set the value of paramObj to the
// to the value of the variable named myVariable passed from FlashVArs in the HTML
var paramObj: Object = LoaderInfo(this.root.loaderInfo).parameters.myVariable;
ExternalInterface.call('alert', 'hello world'); // set the text of the text instance named text1. Use the toString() method
var myVideo: Video = new Video();
addChild(myVideo);
var nc: NetConnection = new NetConnection();
nc.connect(null);
var ns: NetStream = new NetStream(nc);
myVideo.attachNetStream(ns);
ns.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
ns.play(paramObj.toString());
function doNetStatus(e: NetStatusEvent): void {
switch (e.info.code) {
case "NetStream.Play.Stop": //Playback has stopped.
ExternalInterface.call('JsTestFunction', 'The_String');
case "NetStream.Buffer.Empty":
ExternalInterface.call('JsTestFunction', 'The_String');
}
}
Help.
To make things simple, let’s start with getting an alert(“TEST”); working on Edge, I have that working on chrome by doing this…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script>
function Test() {
alert("TEST");
}
</script>
</head>
<body>
<object type="application/x-shockwave-flash" data="test.swf" width="550" height="400" name="movie_name" id="movie_name" align="middle"> <param name="movie" value="test.swf"/> </object>
</script>
</body>
</html>
And the AS3.0
ExternalInterface.call("Test");
^
Doesn’t work on Edge.