SimpleViewer-Pro can be embedded in a HTML document, a Flash movie or a Flex application.
For full instructions on embedding SimpleViewer-Pro into a HTML page, view the SimpleViewer HTML Embed Guide.
SimpleViewer-Pro can be embedded into a Flash container movie. This is useful if you want to integrate SimpleViewer into a full Flash website.
Embedding SimpleViewer-Pro in Flash requires the embedding movie to be ActionScript 3 and requires Adobe Flash CS3 (or later) authoring software. Embedding SimpleViewer-Pro in Flash requires a basic level of Flash authoring experience.
For an example of embedding SimpleViewer-Pro into a Flash container movie, check the examples/flash_embed/simpleviewer_flash_embed.fla file in the Pro download, or view the online demo. This example also show how to switch between multiple galleries and use of the API to control the galleries.
SimpleViewer uses StageScaleMode.NO_SCALE and StageAlign.TOP_LEFT. Check the resize code in the example FLA to see how to handle resizing with these parameters set.
The following steps describe how to load SimpleViewer into a container movie:
var svAPI:Object; //svAPI is the object to call API methods on
var svLoader:Loader = new Loader();
addChild(svLoader);
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
svLoader.load(new URLRequest("simpleviewer.swf"));
/**
* Fired when preloader is available
* Can set gallery flashvars at this point
*/
function onViewerInit(e:Event):void{
Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded);
var options:Object = Object(svLoader.content).embedOptions;
options.galleryURL = "gallery.xml";
}
/**
* Fired when gallery has completely loaded. API is now available.
*/
function onGalleryLoaded(e:Event):void{
svAPI = Object(svLoader.content).api;
svAPI.setSize(640,480);
}
SimpleViewer-Pro can be embedded into a Flex application. For an example of embedding SimpleViewer-Pro into a Flex application and using the API to control it, check the examples/flex_embed/ folder in the Pro download. View Online Demo.
Embedding SimpleViewer-Pro in Flex requires ActionScript 3 and requires Adobe Flex Builder 3 (or later) authoring software. Embedding SimpleViewer-Pro in Flex requires a basic level of Flex experience.
To view and edit the code in this example do this: