Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with ExternalInterface.call and Internet Explorer

3 views
Skip to first unread message

tcarrillo158

unread,
Apr 1, 2009, 1:51:15 PM4/1/09
to
Hi, I惴 developing a site, (http://www.gen-studio.com/avelart2/), and I惴 using
a swf to display a set of thumbs that when clicked show an item and its
description on the browser, those items might be images or video, everything
works fine with the images.

And actually it works fine with the videos too, when using Firefox, but when I
test the page on Internet explorer it just doesn?t work!

On principle let me describe how it愀 supposed to work, a thumbnail when
clicked sends an id number to javaScript using
ExternalInterface.call(?myFunction?,myId); -I惴 using AS3 for the swf愀-

the javaScript file has already loaded (ever since$( document).ready) a XML
file which uses to match the id with a file and the description, if the item
to show it愀 a video, then it creates a variable which holds a string with the
proper html to embed a swf (a swf movie player that resides just next to the
HTML file), when loaded, the swf movie player uses ExternalInterface.call() to
ask for the source of the video that has to play, and that function is as
follows:
[i]
setVideo: function(){
alert("hola");
return comun.miVideo;
}[/i]

(The alert(?hola?); is just to test that the function is being called), which
it is, but it returns null as a value instead of the proper string, and this
happens only on internet Explorer, but works correctly on Firefox.
I扉e been reading all day about the subject and found a few interesting
things, which though have made me narrow my problem, they haven愒 just provided
me with a solution, what I found so far:

-I must have in account flash security issues: Checked (my actionScript
follows:)
[i]
import fl.video.*;
import flash.external.ExternalInterface;

flash.system.Security.allowDomain("*");


var vid:FLVPlayback = this.miPlayer;
vid.source = flash.external.ExternalInterface.call("comun.setVideo");[/i]

-ExternalInterface and Internet explorer don愒 work properly when tested
locally: Checked (I have a server on my PC and I惴 testing the site as well in
the above direction).

-The object tag holding the swf must have a proper id attribute: Checked.

-It愀 super important the way the object tag is formed: Checked, and I also
tested the tag separately (I put it directly in the HTML instead of adding it
via javaScript) and it worked as expected in both Firefox and Internet
Explorer, which leads me to believe:

-I read somewhere that if you add the object tag by using innerHTML or
appendChild, returning values from javaScript to swf won愒 work, but I couldn愒
find an explanation nor a solution.

Well, as I said now I扉e been looking all day for an answer, so I really hope
you can help me or give me some advice on the subject, thank you so much for
your time!


xchanin

unread,
Apr 1, 2009, 11:05:55 PM4/1/09
to
I checked you link but I didn't see anything, but I think I understand what
you're talking about. There is an issue with cross domain security and using
objects with IE, Microsoft doesn't allow it. I think, assuming I'm on the right
track with understanding your issue, the way you can get cross domain data in
IE is to use an IFrame.

tcarrillo158

unread,
Apr 2, 2009, 12:51:01 PM4/2/09
to
Sorry! my bad, I wrongly entered the link, but already corrected it, I hadn´t
heard about what you tell me - I must consider using i-frames ? -though, I have
almost narrowed my problem to a few lines of javascript, the ones that embed
the swf into the HTML, (if you have the time to check it of course :P )
http://www.gen-studio.com/avelart2/bases/avelart.js lines 98 to 121, thank you
so much for answering ! :)

xchanin

unread,
Apr 3, 2009, 12:24:29 AM4/3/09
to
Seems to work huh. At least I was able to see the intro video in both IE and FireFox.

tcarrillo158

unread,
Apr 3, 2009, 2:08:14 PM4/3/09
to
Hi! it solved itself !! (nahh, I wish), but it indeed had a solution, it was
something quite simple, and I don?t really understand why it was not working in
the first place, but here is the thing:

I?m learning jquery and this is the first proyect I?m officially using it, so
I was using $('#myDIV').append("string"); to embed the swf, (and it was working
perfectly on Firefox), so since I had narrowed my problem to those lines, I
decided to try some good-old-fashioned-javaScript and changed it for: var myDiv
= document.getElementById('thatParticularDiv'); myDiv.innerHTML = ('string');
and it worked both in Firefox and IE !!!!!! :)

I?m quite happy about it, and if someone knows what?s the issue with my
jquery approach I would love to hear it. THANKS !!

0 new messages