I was busy with this code wich works fine.
function traceMyPage(id) {
SWFAddress.onChange = function() {
var addr = SWFAddress.getValue();
switch (addr) {
case ‘/’ :
var the_html_name = pages[id].name;
SWFAddress.setValue(the_html_name);
SWFAddress.setTitle(the_html_name);
my_info.htmlText = pages[id].desc;
main_holder.loadMovie(pages[id].thumb);
break;
case ‘/Testpage 1’ :
SWFAddress.setTitle(“Testpage 1”);
my_info.htmlText = pages[0].desc;
main_holder.loadMovie(pages[0].thumb);
break;
case ‘/Testpage 2’ :
SWFAddress.setTitle(“Testpage 2”);
my_info.htmlText = pages[1].desc;
main_holder.loadMovie(pages[1].thumb);
break;
case ‘/Testpage 3’ :
SWFAddress.setTitle(“Testpage 3”);
my_info.htmlText = pages[2].desc;
main_holder.loadMovie(pages[2].thumb);
break;
case ‘/Testpage 4’ :
SWFAddress.setTitle(“Testpage 4”);
my_info.htmlText = pages[3].desc;
main_holder.loadMovie(pages[3].thumb);
break;
case ‘/Testpage 5’ :
SWFAddress.setTitle(“Testpage 5”);
my_info.htmlText = pages[4].desc;
main_holder.loadMovie(pages[4].thumb);
break;
case ‘/Testpage 6’ :
SWFAddress.setTitle(“Testpage 6”);
my_info.htmlText = pages[5].desc;
main_holder.loadMovie(pages[5].thumb);
break;
}
};
}
function showPage(id:Number, clips:Array) {
var the_html_name = pages[this.id].name;
SWFAddress.setValue(the_html_name);
my_info.htmlText = pages[this.id].desc;
main_holder.loadMovie(pages[this.id].thumb);
}
Now this isnt dynamic, so I was working with another solution.
See code below…
But when I put SWFAddress.setStrict(false) to SWFAddress.setStrict(true)
than the code won’t work.
SWFAddress.setStrict(false);
SWFAddress.onChange = function() {
var value = SWFAddress.getValue();
//trace("the value is: "+value);
var path = SWFAddress.getPath();
//trace("the path is: "+path);
var id = SWFAddress.getParameter('id');
//trace("the id is: "+id);
for (var i:Number = 0; i<pages.length; i++) {
if (pages*.name == value) {
my_info.htmlText = pages*.desc;
main_holder.loadMovie(pages*.thumb);
}
}
var title = 'SWFAddress Website';
var names = SWFAddress.getPathNames();
for (var i = 0; i<names.length; i++) {
title += ' / '+names*.substr(0, 1).toUpperCase()+names*.substr(1);
}
var id = SWFAddress.getParameter('id');
if (typeof id != 'undefined') {
title += ' / '+id;
}
SWFAddress.setTitle(title);
};
What goes wrong here?
Can the code also have more improvements?
Every input is welcome.
Thnx!