Oleg Tarasenko
Oleg Tarasenko

Reputation: 9610

jQuery: Loading swf file from server after the button click

I have a web page with swf file defined this way

<object width="600" height="400" type="application/x-shockwave-flash" id="plist" data="/site_media/apps/problemme.swf">
   <param id="board" name="flashvars" value="id={{ id }}">
</object>

What I want to do is to reload this object after button click (also I want to change value of flashvar parameter).

What I've done so far is

function clickRetryButton(){
  $("#board").attr('value', 'id={{ 1 }}'); 
}

This function changes value of the flashvar after the button is clicked. I wonder how can I refresh the flash object (so it's built from the beginning with a new flashvar)?

Upvotes: 0

Views: 419

Answers (1)

N 1.1
N 1.1

Reputation: 12544

You can use cloneNode to copy the object, remove the old one and append the new one.

var old = document.getElementById("plist");
var new = old.cloneNode(true);
new.children[0].value = "id={{ 1 }}"; //change value of flashvar
//remove the old node from parent
//append the new node to parent

Upvotes: 1

Related Questions