ExternalInterface class

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

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
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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. :(
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

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.
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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]
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

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
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

Thanks, brother!

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 11 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.