0
votes

So We got a playlist with various swf files, some old as2 animations, some newer. We download them to a local folder, and can play them fullscreen. all with one AIR (actionscript) application. Now we know that in the newer files there are ExternalInterface.Call(some arguments) calls. And we need to handle them in the hosting AIR application. So far we have a class inherrited from MovieClip, with the following constructor:

public function FlashClip()
    {
        ExternalInterface.addCallback("FlashPlayerControl1FlashCall",FlashPlayerControl1FlashCall);
    }

when we run the application whe got the following error:

Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime. at Error$/throwError() at flash.external::ExternalInterface$/addCallback() at Video::FlashClip()[C:\Users\Daan\Adobe Flash Builder 4.6\TINS-v2-1\TINSV2\src\Video\FlashClip.as:12] at Video::FlashPlayer/BestandOpend()[C:\Users\Daan\Adobe Flash Builder 4.6\TINS-v2-1\TINSV2\src\Video\FlashPlayer.as:43]

On the following line:(FlashPlayer.as:43)

   var clip:FlashClip = new FlashClip();

So, My question is this. Is what we are trying to do even possible. Or do we need tot embed a javascript container in the actionscript AIR application? Or does anyone know how we are going to get this to work?? Note: We cannot alter the existing swf files. we dont even have the original .fla's

1

1 Answers

1
votes

The documentation says what you are trying to do is not possible:

In Adobe AIR, the ExternalInterface class can be used to communicate between JavaScript in an HTML page loaded in the HTMLLoader control and ActionScript in SWF content embedded in that HTML page.

For ExternalInterface to work, it needs to communicate w/a Javascript "layer" that the browsers provide. You won't get this functionality in AIR, unless you load an HTML page that has your SWF content embedded in it.

I've linked to the docs for HTMLLoader which would allow you to do this.

[Edit]

Appending a simple AIR app (note it's Flex 3.6, sorry that's what my client uses) that loads a web page, in case it helps.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
                        layout="absolute"
                        width="800" height="600"
                        creationComplete="onCreationComplete()">

    <mx:Script>
        <![CDATA[
            import mx.core.UIComponent;

            private function onCreationComplete():void
            {
                var loader:HTMLLoader = new HTMLLoader();
                var request:URLRequest = new URLRequest("http://www.adobe.com");
                loader.width = 800;
                loader.height = 600;
                loader.load(request);
                var uic:UIComponent = new UIComponent();
                uic.addChild(loader);
                addChild(uic);
            }
        ]]>
    </mx:Script>
</mx:WindowedApplication>