Closed GoogleCodeExporter closed 9 years ago
Re: And, (this part may not be a bug!) the newly created flash object (which
replaces the alternative content with the specified id) is NOT given the
same id as what it replaced, so it's not available to the document.all[]
accessor. for instance, after the swf is embedded, a call to document.all
["myContent"] comes back as undefined.
This is exactly the problem. Your Flash content does entirely replace your HTML
content, including IDs, so that's why your external interface link is broken.
Just
add the same ID as an attribute to your Flash definition and you will be fine.
A more in depth discussion can be found here:
http://groups.google.com/group/swfobject/browse_thread/thread/6aa4458a4028506/77
a6baa1d3a42cac?lnk=gst&q=bobbyvandersluis#77a6baa1d3a42cac
Original comment by bobbyvandersluis
on 2 Jan 2008 at 10:53
Thank you for pointing me to that forum post. That is helpful to understand
exactly
what it is doing.
However, I'm still not clear on *how* I am supposed to add an ID attribute to
my
flash "definition", as you suggest. I already have the ID on my <div> on my
container that gets replaced.
But the embedSWF() function is the one who makes the Flash definition. Once
embedSWF
() is done replacing my original <div> (it was able to do so because my div had
the
correct id), I no longer have a way via script access the object (by id, for
instance) to give it an id... i have a chicken-and-the-egg problem.
shouldn't embedSWF() give the new object it creates the same ID as the <div> it
replaced? If it's supposed to be doing that, it doesn't appear to be doing so
in my
IE7.
Original comment by get...@gmail.com
on 2 Jan 2008 at 3:30
Re: However, I'm still not clear on *how* I am supposed to add an ID attribute
to my
flash "definition", as you suggest.
It's all in the documentation, really:
http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
Use something like:
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {
id: "myContent"
};
swfobject.embedSWF("myContent.swf", "myContent", "300", "120",
"9.0.0","expressInstall.swf", flashvars, params, attributes);
</script>
You can reuse the old id or define an entire new one, in which case you use a
different id for replacement and for internal communication, whatever option
you prefer.
Re: shouldn't embedSWF() give the new object it creates the same ID as the
<div> it
replaced?
No, again if you read
http://groups.google.com/group/swfobject/browse_thread/thread/6aa4458a4028506/77
a6baa1d3a42cac?lnk=gst&q=bobbyvandersluis#77a6baa1d3a
you will know why we chose not to.
Original comment by bobbyvandersluis
on 2 Jan 2008 at 5:31
Original issue reported on code.google.com by
get...@gmail.com
on 29 Dec 2007 at 8:53