ExternalInterface.call intercepted by another script ?

Hi,

I have an actionscript based flash object which has this code in it :


import flash.external.ExternalInterface;
import System.capabilities;

var user:String            = String(ExternalInterface.call ("eval", "function lan2() { return navigator.userLanguage;  } lan2();"));

trace_txt.text = user;

when published and inserted into an HTML page it works great and I always get a value (at least on IE)...

but when two of these object are layout one after the other, the second one stops working!

I wonder, what can it be that causes this weird problem ?

also included is the html which creates two objects of this flash file , the first one returns with a value, the second returns null...

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=windows-1255" />	
</head>
 
<body>
<center>
 
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="400" height="100" id="test" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="test.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="test.swf" quality="high" bgcolor="#ffffff" width="400" height="100" name="test" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
	</object>
 
</center>
 
<BR><BR>
 
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="400" height="100" id="test" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="test.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="test.swf" quality="high" bgcolor="#ffffff" width="400" height="100" name="test" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
	</object>
 
 
 
 
 
 
</body>
 
</html>

Open in new window

LVL 1
moshemAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

moshemAuthor Commented:
I just found out that if I change the ID value of the OBJECT tag to a unique one, all is good...

the problem is I can't control the ID on every page the widget will be on..

I need a way around this..


thanks
0
rascalpantsCommented:
IDs in an HTML page always are unique... that is just how it is...  there is no other way around that issue...

why don't you have control over the ID?  what are you limitations to making this work?


more info please...

rp / ZA
0
moshemAuthor Commented:
I am putting my widget on foreign websites, which I can't control, some don't even have an ID parameter...

anyway, right now I am facing the doubleclick ad serving platform which is what one of the major sites I publish to use...

for some weird reason...all object ID for all flash objects on a doubleclick page are named "flashad"
0
rascalpantsCommented:
you need to alert the web developers on this site to the issue...  you can't use the same ID with multiple items in the HTML...  you just can't program that way.

they need to be unique... the is no work around.


rp / ZA
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.