ExternalInterface class

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post October 19th, 2007, 10:22 am

Does anyone have any experience with the ExternalInterface class?

I've been trying to implement this for sometime and have gotten quite irregular unpredictable results. Some of my test files work fine and some not at all. I can't figure out what variations are causing this.

I've read about some problems with asyncronous stacks of javascript calls, but I can't find a reliable work around.
- dM
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 19th, 2007, 10:22 am

  • krismeister
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 21, 2006
  • Posts: 202
  • Status: Offline

Post October 19th, 2007, 1:29 pm

Its been very reliable for me, even though I don't use it excessively.

Stack calls going Flash-to-JS?
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post October 19th, 2007, 1:38 pm

krismeister wrote:
Its been very reliable for me, even though I don't use it excessively.

Stack calls going Flash-to-JS?


Both directions.

This is for an application I built about 3 years ago. The long and short is it administers a test with 4 question types (matching, fill in the blank, true/false, multiple guess) from data supplied from XML. To date, all the external calls have been Flash to JS only using FSCommand.

Now I'm trying to update the app with JS values being passed to Flash using the ExternalInterface class.

Are you using Flash 9? I'm still using 8. :(
- dM
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13458
  • Loc: Florida
  • Status: Offline

Post October 20th, 2007, 2:43 am

By any chance do the unexpected results have anything to do with when the application first loads, or does it act strange even well into the application ?

Inside of JS onLoad handlers I've had an issue where the JS onLoad fires before the SWF has had a chance to register the method for JS to call, which ends up erroring out & killing further execution.

Disabling all JS to SWF communication possibilities untill the SWF calls a JS "im_ready()" type of method works around that.
Strong with this one, the sudo is.
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post October 20th, 2007, 4:30 am

This sound promising, joebert.

It's basically been all or nothing for me. When I first looked at this class, I thought, "...well that looks great, easy, no sweat". So, I stuck it in my app and the JS function doesn't fire, at all.

I went back to basics and developed a test file which worked fine. So back to the app - no worky. Back to test file - worky. Back and forth and back and forth and ... anyway

Flash
Code: [ Select ]
import flash.external.*;
btn.onPress = function(){
  myVar = ExternalInterface.call("Funky", "Chris");
  myMode.text = myVar;
}
  1. import flash.external.*;
  2. btn.onPress = function(){
  3.   myVar = ExternalInterface.call("Funky", "Chris");
  4.   myMode.text = myVar;
  5. }

javascript
Code: [ Select ]
function Funky(name){
  alert("Hello" + name);
  return "review";
}
  1. function Funky(name){
  2.   alert("Hello" + name);
  3.   return "review";
  4. }


Here are other possibly confounding factors:
    The app has 3 frames. Frame 1 establishes the XML connector. Frame 2 waits for XML to load and confirm. Frame 3 is the app. I've tried to implement this in all three frames, individually, and in it's own layer that covered all 3 frames.

    The hosting page is loading a number of different javascripts. Some inline, some external.

    A good bit of the app is still using FSCommand for outbound communication.

So, how would I call a "JS, I'm ready, are you?()" function/method?[/list]
- dM
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13458
  • Loc: Florida
  • Status: Offline

Post October 20th, 2007, 5:12 am

I dug up everything I've done here at Ozzu with ExternalInterface because I'm actually back on the laptop I had when you were here years ago because my new laptop died & I can't use Flash 8 anymore.

website-design-forum/update-vars-sent-flash-without-get-loadvars-t78258.html
flash-forum/javascript-flash-firefox-t74795.html
flash-forum/javascript-fscommand-communicate-with-t76198.html
flash-forum/userfrienly-links-flash-based-websites-t75469.html

Apparently, I did have a problem, I don't remember it though & it looks like I never found out what was happening. :scratchhead:
flash-forum/hanging-ie7-page-exit-t74808.html
Strong with this one, the sudo is.
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post October 20th, 2007, 5:25 am

Thanks, brother!
- dM

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 28 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.