Topic: Dynamically setting XML-parameters

Hello to the SV-support-team,

I was wondering if it's possible to make certain properties that are initially defined in the gallery.xml-document dynamically accessible. I tried to change values for some of them - e.g. maxWidth - which of course isn't possible since they're protected. Browsing the classes with describeType() didn't bring up public setters nor a config-object for those properties.

Two things I think would be extremely useful to a lot of customers would be (if they exist and I haven't found them then sorry)

- API-methods for setting config-parameters, e.g. a setGalleryOptions( config:XML ) and then a method to open the gallery
- API-methods for changing various properties at runtime, e.g. setMaxWidth(w:Numer) on the image-area-object.

This would allow for custom use-cases.

best regards,
stephan

Re: Dynamically setting XML-parameters

You should be able to set or change any of the options via ActionScript.

From the flash_embed example included in the pro download with the addition of options for maxImageWidth and maxImageWidth:

//Init variables
var svAPI:Object; //svAPI is the object to call API methods on
var swfLoaded:Boolean = false;
var svLoader:Loader = new Loader(); //loader to load SimpleViewer swf into

//add svLoader to the "mcLoader" stage movieclip on the main timeline
mcLoader.addChild(svLoader);
//listen for SWF loaded
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);

...

    //listen for
    Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded); 
    
    trace("setViewerFlashVars");
    var options:Object = Object(svLoader.content).embedOptions;    
    options.maxImageWidth="2000";
    options.maxImageHeight="2000";
Mike Richards
SimpleViewer Support Team.

Re: Dynamically setting XML-parameters

Thanks, that works.

Can I switch options during runtime?

With

options.imageScaleMode = "FILL"

I can set it during initialization. I'd like to switch scale-modes while the gallery is already open. (e.g. between fill and scale_up).

regards,
stephan

Re: Dynamically setting XML-parameters

Ok, found it.
svAPI.setOption( opt, val)