Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Embedded .swf's calling javascript from air container

$
0
0

1) I have an html/ajax air app version 1.5.1

 

2) This air app embeds .swf files from an external source / web server & plays the embdded .swf inside air.

 

3) The embedded .swf file has a button with an onClick event

 

function onClick(event:MouseEvent):void {
ExternalInterface.call("someJavascriptMethod()" );
}

 

4) The javascript method to be called is already parsed inside the containing Air app and is waiting to be triggered.

 

5) When the onClick is triggered, the following error is thrown.

 

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$/call()
at stress_fla::MainTimeline/onClick()

6) On investigation I found on your livedoc's website that Air does not support the ExternalInterface.call method.

 

http://livedocs.adobe.com/labs/air/1/aslr/flash/external/ExternalInter face.html

 

Look for Note: Adobe AIR currently does not support the ExternalInterface class.

 

7) Does anyone here know how I can get an embbeded .swf file to call javascript methods in the containing air application? I have had a look at the getUrl method but this is now longer supported & even the FS command but still to no avail. I may have a work around by inserting a DOM element over the top of the embedded .swf but this is not an elegant solution & want the .swf to talk directly to the air app container.

 

All help & comments welcome

Thanks

Kyle

 

Additionally I have found

 

http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e6 3e3d118666ade46-7ed4.html

 

Using the Html Loader so that Actionscript can call/manipulate the dom objects. At first I was whopee but then I tried the examples listed in the help. The HTMLLoader class is only available in Air. When trying to use import flash.html.HTMLLoader; Flash C4 complains that the Definition cannot be found on compile time & therefore does not export my movie correctly. Has anyone else had this problem or have a solution??

 

More additions:

 

The reason the htmlLoader class was not compiling was due to the source action script provided being ActionScript 2.0 - the htmlLoader class is a 3.0 library.

 

However, after more investigation I have found the current structure.

The air app has an html base/root doc. On periodic javascript events - .swf files are downloaded via

 

videos = new air.Loader();

netStream     = new air.URLRequest(path + file);

videos.load(netStream);

 

So now I have a html container in my air app that creates a new air.Loader which downloads the external .swf file in which I want an onClick event in the action Script of the downloaded .swf file to call a Javascript method of the parent air container. Simple yea?

 

Or am I making life to hard for myself? Have been looking at the security snadboxes but I don't see how I can get the .swf file to talk nicely with the outer air container. Please help if able.

Thanks

Kyle


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>