Closed GoogleCodeExporter closed 8 years ago
Original comment by erik.eng...@gmail.com
on 23 Feb 2010 at 7:58
Original comment by erik.eng...@gmail.com
on 23 Feb 2010 at 7:58
You would need to just basically rewrite the html of the object. This is the
way
I've done it:
1. Get the source of the generated output (if you are using swfobject.js to
load it,
you need to look at the resulting html from Firefox's developer plugin)
2. Set the whole source equal to a javascript variable
3. Replace whatever is between SwfFile= up to the & by a variable that holds
the
name of the file you wish to see
4. Wrap the object in <div> tags, give it an id
5. Bind an event (click, change, etc) to replace html inside the divs by what
you've
created above, like so $("#mydiv").html(template);
6. You're done.
Btw, if you just want to get the file name replaced, use this code:
var new_arr = new Array();
//Get the value of whatever is in the <param> tag with the name of 'flashvars'
and
split it at the ampersand
new_arr = $("#FlexPaperViewer param[name=flashvars]").val().split('&');
//Set the variable with where your filename is located
str = 'SwfFile=yourfilename.swf';
//Recreate the string, starting with the second element of array, since we're
replacing the 1st element by our variable str
for(i = 1; i < new_arr.length; i++)
{
str += "&"+new_arr[i];
}
//And do the actual value replacement of the parameter
$("#FlexPaperViewer param[name=flashvars]").val(str);
The code above just does the file replacement, but not the actual reloading,
which is
what you're asking for. You can make it into a function, if you wish, by
passing a
parameter with the filename in and binding it to an event.
The reloading is much easier, since it's straightforward (as described above).
Hope
that helps.
-Ilya
Original comment by ily...@gmail.com
on 26 Feb 2010 at 4:39
I'm interested in something like this too. Suppose I have a folder of files
converted
to swf on my server, is there an easy way to just, say, use a drop-down menu to
switch
from one file to the other?
It looks like what Ilya is suggesting is what I would need, but I'm too new at
all of
this to be able to implement the suggestion. Is there a working example
somewhere that
I can learn from?
Original comment by mrd...@gmail.com
on 29 May 2010 at 6:51
I think this will a very important feature of the viewer for dynamic playing
swf
files.
Original comment by Vincenth...@gmail.com
on 3 Jun 2010 at 6:44
my codes which main idea from ilyaok:
flashvars_array = $("#flashContent param[name=flashvars]").val().split("&");
new_flashvars = "SwfFile=" + $(this).attr("value") +".swf";
for (i=1; i<flashvars_array.length; i++){
new_flashvars += "&" + flashvars_array[i];
}
$("#flashContent param[name=flashvars]").val(new_flashvars);
$("#flashContent").hide().fadeIn('fast');
But this method still need redraw flexpaper.
I hope the author of flexpaper can write this function one day.
Original comment by leo.ss.pku@gmail.com
on 5 Jun 2010 at 2:57
Fixed in code branch and will be fixed in 1.3
Original comment by erik.eng...@gmail.com
on 21 Jun 2010 at 9:38
Original issue reported on code.google.com by
leo.ss.pku@gmail.com
on 23 Feb 2010 at 10:59