Can't change the flash file later with swfobject

1.1k Views Asked by At

I use swfobject to load a youtube embedded video, it works nice, but when i try to load another youtube video after a specific time it doesn't work, It looks like the container div is totally replaced with the swf instead of putting it inside it.

Note: i attempt using swfobject.embedSWF(path,divID,width,height) to load other videos which doesn't work.

Any ideas?

2

There are 2 best solutions below

0
On BEST ANSWER

SWFObject v2.x replaces the target HTML element with an <object>.

If you want to use the same target element for multiple SWF embeds, you'll need to re-create the target element before attempting your subsequent embed. Here's a link to a tutorial for this topic (scroll down to "Replacing a loaded SWF with another SWF").

1
On

I know this is an older post, but just thought I'd mention that I ended up just using the YouTube javascript API to switch the video. Simpler, and the transition looks cleaner than trying to remove the object and add another one.