I think you are a bit confused with how externalInterface and SWFObject use
the id property.
The DOM id is what externalInterface uses to communicate with the swf. This
is also what is set in the 2nd param of embedSWF() (or overwritten with the
attributes object id property).
If you want to pass into flash the id for external interface to call to for
some reason then you want something like:
(I have separated the flashvars out to make it easier to understand)
var flashvars = {};
Flashvars.id = "ofc152299052swf";
swfobject.embedSWF("/path/flash-chart.swf", "ofc152299052swf", 640, 300,
"9.0.0", "/path/expressInstall.swf", flashvars, params);
This sets the DOM id to ofc152299052swf as well as ensuring that the
internal flash var is the same.
Does this make sense?
Aran
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Patrick McKinnon
Sent: Tuesday, 28 April 2009 12:40 PM
To: SWFObject
Subject: AllowScriptAccess="always" doesn't work with a flashvar called "id"
I'm having trouble passing a flashvar called "id" to my flash
program. For some reason, when I use swfobject to embed the flash
object, I cannot access ExternalInterface flash callbacks regardless
of my AllowScriptAccess parameter.
For example, with the following code I cannot access any flash
callbacks:
<script type="text/javascript">
swfobject.embedSWF("/toscawidgets/resources/tw.ofc.widgets/static/open-
flash-chart.swf", "ofc152299052swf", 640, 300, "9.0.0", "/toscawidgets/
resources/tw.swfobject.widgets/static/expressInstall.swf", {"id":
"ofc152299052"}, {"AllowScriptAccess": "always"})
</script>
This is the DOM as it looks after the embedSWF:
<object id="ofc152299052swf" width="640" height="300"
type="application/x-shockwave-flash" data="/toscawidgets/resources/
tw.ofc.widgets/static/open-flash-chart.swf" style="visibility:
visible;">
<param name="AllowScriptAccess" value="always"/>
<param name="flashvars" value="id=ofc152299052"/>
</object>
If I change the "id" parameter for the flashvarsObj argument to
"ids" (or anything other then "id" it seems), the ExternalInterface
callbacks work properly. This is non-ideal obviously because I'm
using a pre-compiled flash file, and can't easily change the expected
"id" flashvar.
Interestingly, if I paste the updated DOM embed generated by swfobject
into a static html file, the callbacks work fine.
Does anybody have a clue what might be happening?
Thanks for your help, my apologies if this has already been answered,
its really hard to get useful search results for the word "id" ;-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---