I have been successful 开发者_C百科in dynamically loading an album in SSP before, but using SSP Standalone. I did it like this:
var flashvars = {
xmlFilePath: "http://site.com/ssp_director/images.php?album=5"
}
What I'm looking to do now, though, is dynamically load a gallery when the page loads, using text entered in the javascript, or flashvars I'd assume. I'm using ActionScript 3 with this, so I'm not sure if I have to do something to the SSP instance in Flash. I'm not very good with AS3, so following advice or tutorials is about all I can muster. I'm also using SSP Director, so my gallery XML URLs would be similar to above in the example code.
I'd be elated if this is possible, otherwise I will have to find an alternative solution. Thanks so much for help!
Reading FlashVars
in AS3 is not as simple as it used to be in AS2. Here's some code that will do this:
import flash.display.LoaderInfo;
var fvars = LoaderInfo(this.root.loaderInfo).parameters;
var xmlFilePath="http://site.com/ssp_director/images.php?album="+fvars.albumid;
Assuming that you'll have a flashvars
variable named albumid
passed in the object/embed
tag.
This is what I ended up doing to get it to work:
Using this article only to edit my fla/swf file: http://wiki.slideshowpro.net/SSPfl/C-DynamicallyAssignXML
And then putting this in my SWFObject code:
var flashvars = {
xmlfile: "http://site.com/images.php?gallery=2",
xmlfiletype: "Director"
};
swfobject.embedSWF("slideshow.swf", "slideshow", "640", "634", "9.0.0","expressInstall.swf", flashvars);
精彩评论