I need help with ExternalInterface

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.

Because this seems like an Edge-only issue, see if the information here helps: http://blogs.adobe.com/flashplayer/2015/10/flash-player-guidance-for-internet-explorer-11-and-microsoft-edge.html

A few sections down, they talk specifically about ExternalInterface :slight_smile:

Hi Kirupa, thank you for your response. I don’t exactly understand the instructions, it seems, I must use the right “embed” implementation, and, well, I tried copying and pasting the bottom snippet of code replacing the .swf file with mine, “test.swf” and I still don’t have the results I want. Any ideas ? Maybe I’m not using the embed properly, do I need to modify the code more than that?? Please help.

One more thing,

I look at the debug console in Edge and noticed this

gets me this error, Malformed start tag. Attributes should be separated by whitespace. any ideas?

Fixed that issue, still not working.

One more observation. I see I can not embed a SWF at all in Edge??? Besides the ExternalInterface not working, I tried using Dreamweaver to implement my SWF also, still no go on Edge.

It seems im getting closer to solving my problem.

I use the “publish” feature on FlashCS6 and manage to get a page that works with edge if its offline, but on my 127.0.0.1/tst.html page, it doesn’t work on Edge. It does work on Chrome. Any idea?

If it works locally but not in localhost, I wonder if Flash content is being blocked by Edge. The following post details some of the upcoming changes, but some of the current changes might be affecting you: https://blogs.windows.com/msedgedev/2016/12/14/edge-flash-click-run/