Hello,

I have been working with SWFAddress and Slideshow Pro to create slideshows with deeplinks.

I have most of its working, but I'm still encountering an issue when accessing a image directly from a url. SWFaddress gets the correct value from the url, but then SSP updates with the first image from that album.

here's the example:
http://robertocarroll.com/test/newswfaddress24

It all works well except for when loading from a url, e.g.

http://robertocarroll.com/test/newswfad content-97

Sometimes it works. Sometimes it loads the first image from that album.

I'm checking if SSP is loaded and if it isn't, using a setstartalbum method to load the correct album, but then it is going through and thinking it is loaded and updating it again. Anyone have any ideas to make this work?

best wishes,
Rob


import net.slideshowpro.slideshowpro.*;
import net.slideshowpro.thumbgrid.*;
import SWFAddress;
import SWFAddressEvent;

var albumId:String;
var contentId:String;
var sspLoaded:Boolean;
var validator:Validator = new Validator();
sspLoaded = false;

notValid_txt.visible =false;


SWFAddress.addEventListener(SWFAddressEvent.INIT, __init);
//Which would then register the CHANGE listener:

function __init(event:SWFAddressEvent):void
{
SWFAddress.addEventListener(SWFAddressEvent.CHANGE , __handle);

}
//Your handler function should handle changes in the URL. This will handle the beginning url when it first initializes and when you use SWFAddress.setValue() to change the page:

function __handle(event:SWFAddressEvent):void
{
var theAddress:String = SWFAddress.getValue();

if(theAddress == "/")
{
trace("show TG");
my_ssp.unloadContent();
my_tg.visible =true;
my_ssp.startup = "Load Data Then Wait";
}

var pathNames : Array = SWFAddress.getPathNames();

for (var i = 0; i < pathNames.length; i++)
{
var albumInput:String = pathNames[0];
var valid:Boolean;

valid = validator.checkAlbumNumber(pathNames[0]);

if(valid ==true)
{
t_txt5.text = albumInput;
albumId = albumInput;
}
else
{
notValid_txt.visible =true;
}

var contentInput:String = pathNames[1];
var valid1:Boolean;
valid1 = validator.checkContentNumber(pathNames[1]);

if(valid1 ==true)
{
t_txt6.text = contentInput;
contentId = contentInput;
}

else
{
notValid_txt.visible =true;
}

if(valid==true && valid1==true && sspLoaded==true)
{
t_txt7.text = "SSPloaded"+albumId+"&"+ contentId;
my_ssp.startup = "Load Album";
my_tg.visible =false;
my_ssp.loadAlbum(albumId,contentId);

}

if(valid==true && valid1==true && sspLoaded==false)
{
t_txt7.text = "SSPnotloaded"+albumId+"&"+ contentId;
my_ssp.setStartAlbum(albumId,contentId);
my_ssp.startup = "Load Album";
my_tg.visible =false;




}

}
}



//event listener for SSP

my_ssp.addEventListener(SSPDataEvent.ALBUM_DATA, onAlbumData);

function onAlbumData(event:SSPDataEvent)
{
if (event.type=="albumData")
{
albumId = event.data.id;
}
}

my_ssp.addEventListener(SSPDataEvent.IMAGE_DATA, onImageData);

function onImageData(event:SSPDataEvent)
{
if (event.type=="imageData")
{
contentId = event.data.id;
sspLoaded = true;
updateSSP()

}
}

function updateSSP()
{
//swfaddress set current url bar value to SSP
SWFAddress.setValue(albumId+"/"+contentId);

}



gallery_btn.addEventListener(MouseEvent.CLICK,load Home);

function loadHome(e:Event)
{
SWFAddress.setValue("/");
}