I think I solved the problem!
Not sure how, but I will tell/show what I've changed;
First of all make sure you load the swfaddress javascript file after the swfobject file file in your index.html like this:
PHP Code:
<script src="js/swfobject.js" type="text/javascript" charset="utf-8"></script>
<script src="js/swfaddress.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var attributes = {
id: "myid"
};
var params = {
scale: "noscale",
wmode: "transparant",
allowscriptaccess: "*"
};
swfobject.embedSWF("myswf.swf", "flashcontent", "100%", "100%", "9.0.0", "js/expressInstall.swf", attributes, params);
</script>
Not sure if that was the problem, but it's recommended.
Secondly, I forgot to upload the SWFAddressEvent.as file, I only uploaded the SWFAddress.as file.
I also adjusted my AS a bit:
Instead of calling the activatePage function directly on the menu buttons, I set the SWFAddress Value and let the SWFAddress.onChange function call the activatePage function.
My new AS:
Actionscript Code:
// SWFAddress include
#include "com/swfaddress/SWFAddress.as"
// Load XML
var myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
makehoofdmenu();
SWFAddress.onChange();
} else {
trace("The XML could not be loaded");
}
};
// Prevent XML caching
myXML.load("content.xml?cachebuster=" + new Date().getTime());
// Menu
var tmpWidth = 25;
var spacing = 20;
var hoofdmenuitems:Array;
var hoofdmenutotal;
var page:Number = NaN;
var pages:Array;
var tmpl:Array;
var button:Array;
var activeNo:Number = NaN;
function makehoofdmenu() {
hoofdmenuitems = myXML.firstChild.childNodes[1].childNodes;
hoofdmenutotal = hoofdmenuitems.length;
pages = [];
tmpl = [];
button = [];
for (s=0; s<hoofdmenutotal; s++) {
pages[s] = hoofdmenuitems[s].attributes.title;
tmpl[s] = hoofdmenuitems[s].attributes.template;
button[s] = hoofdmenu.items.createEmptyMovieClip(s, hoofdmenu.items.getNextHighestDepth());
button[s].createTextField("title", 1, 0, 0, 1, 15);
button[s].title.setNewTextFormat(Avenir);
button[s].title.embedFonts = true;
button[s].title.autoSize = true;
button[s].title.html = true;
button[s].title.antiAliasType = "advanced";
button[s].title.selectable = false;
button[s].title.htmlText = pages[s];
// Aligning
button[s]._x = (button[s-1]._x + button[s-1].title.textWidth) + spacing;
// Functions
button[s].buttonNo = s;
button[s].onRollOver = function() {
if(this.buttonNo != page){
select = new Color(this);
select.setRGB(0x000000);
}
activeNo = this.buttonNo;
SWFAddress.setStatus(pages[activeNo].toLowerCase());
}
button[s].onRollOut = function() {
if(this.buttonNo != page){
deSelect = new Color(this);
deSelect.setRGB(0xFFFFFF);
}
SWFAddress.resetStatus();
}
button[s].Status = 0;
button[s].onRelease = function() {
this.Status ++;
activeNo = this.buttonNo;
if (this.Status > 1) {
this.Status = 0;
activatePage(activeNo);
} else {
SWFAddress.setValue(pages[activeNo].toLowerCase());
}
}
}
};
// SWFAddress handling
SWFAddress.onChange = function():Void {
var value = SWFAddress.getValue();
// If URL is direct check witch page it is
pagename = value.substr(1, value.length).toUpperCase();
getPageURL();
// HTML Title
var title = 'MY TITLE';
var names = SWFAddress.getPathNames();
for (var i = 0; i < names.length; i++) {
title = 'TITLE - ' + names[i].substr(0,1).toUpperCase() + names[i].substr(1);
}
SWFAddress.setTitle(title);
}
// Activate Page from URL name
function getPageURL() {
for (s=0; s<hoofdmenutotal; s++) {
// Loop through pages to check witch is the right one
pages[s] = hoofdmenuitems[s].attributes.title;
if (pages[s] == pagename) {
activeNo = s;
activatePage(s);
}
}
}
// Activate Page
function activatePage(p:Number) {
var showFunctie = eval("show"+tmpl[p]);
var hideFunctie = eval("hide"+tmpl[p]);
// If it's a link
if (tmpl[p] == "link") {
var link = hoofdmenuitems[p].firstChild.nodeValue;
getURL(link, "_blank");
// If it's a page
} else {
if (isNaN(page)) {
showFunctie(p);
selectActive(p);
page = p;
} else {
if (page != p) {
if (tmpl[page] == "werk") {
randomBG();
var movie:MovieClip = eval("hoofdmenu.content."+tmpl[page]);
movie.removeMovieClip();
eval("imageflow_"+current).removeMovieClip();
image_info.removeMovieClip();
} else {
var movie:MovieClip = eval("hoofdmenu.content."+tmpl[page]);
movie.removeMovieClip();
}
showFunctie(p);
selectActive(p);
page = p;
} else {
deselect();
hideFunctie();
page = NaN;
activeNo = NaN;
SWFAddress.setValue("");
}
}
}
};
I hope I can help someone with this piece of AS!
Cheers