Visit SlideShowPro.net  Community Forums
SlideShowPro Support Wiki
  
ThumbGrid

Create an instance using ActionScript

If you'd rather not create instances of either the SlideShowPro Player or ThumbGrid by dragging physical instances onto the Stage, and would rather dynamically attach instances from the Library, you can do so.

First, make sure your Library has a copy of the SlideShowPro Player (ActionScript 3) and ThumbGrid in it. Then add the following in an empty keyframe on your timeline:

import net.slideshowpro.slideshowpro.*;
import net.slideshowpro.thumbgrid.*;

var my_ssp:SlideShowPro = new SlideShowPro(this);
my_ssp.name = "my_ssp";
var my_tg:ThumbGrid = new ThumbGrid(this);
my_tg.sspInstance = my_ssp.name;
my_tg.y = my_ssp.height;

Both components will then appear on the Stage, with ThumbGrid positioned underneath the SlideShowPro Player.

Tip: Instantiate ThumbGrid after the SlideShowPro Player

If you'd rather not display ThumbGrid at the same time as the SlideShowPro Player, and would rather show it on-demand (like through a button click or other action), you can do so by wrapping the ThumbGrid portion of the ActionScript above as a function, then call a method to setup ThumbGrid. First, add this:

import net.slideshowpro.slideshowpro.*;
import net.slideshowpro.thumbgrid.*;

// event listener code for a button with an instance name of "my_btn"
my_btn.addEventListener("click",setupThumbGrid);

var my_ssp:SlideShowPro = new SlideShowPro(this);
my_ssp.name = "my_ssp";
var my_tg:ThumbGrid;

Skip a line, then add the following if you are using ThumbGrid 2:

function setupThumbGrid(e:MouseEvent):void {
   my_tg = new ThumbGrid(this);
   my_tg.sspInstance = my_ssp.name;
   my_tg.y = my_ssp.height;
   my_tg.displayCurrentAlbum();
}

This will add ThumbGrid and instruct it to display the current album in view in the SlideShowPro Player. You can also use displayAlbum() or displayGallery() if you'd like to start ThumbGrid with a specific album or the show the Gallery screen.

If using ThumbGrid 1, use this instead:

function setupThumbGrid(e:MouseEvent):void {
   my_tg = new ThumbGrid(this);
   my_tg.sspInstance = my_ssp.name;
   my_tg.y = my_ssp.height;
   my_tg.setup();
}

This will add ThumbGrid and instruct it to display the current album in view in the SlideShowPro Player.

Page last modified by tdominey on November 14, 2010, at 10:34 AM
© 2011 SlideShowPro. All Rights Reserved.