Ok, so I’m trying out swfAddress (version 2.1) for the first time, and I’m having some issues…
Here’s my really simple test swf.
The left block is called button1_mc, the right block is called button2_mc, and the top, smaller one is called buttonHome_mc. They are all contained within menu_mc.
When you click button1_mc, the whole thing moves left (this would be the ‘page1’ application state). Same thing for button2_mc, but it moves right. When you click buttonHome_mc, it moves back to the center (the ‘/’ application state).
And here’s my AS:
import gs.TweenMax;
import SWFAddress;
// Save the default menu x-position
menu_mc.homeX = menu_mc._x;
// Make an array with key as swfaddress value, value as the button object
swfPages = new Array();
// Function that sets page and shiftX value for a button, and adds it to the swfPages array
addPage = function(mc, page, shiftX) {
mc.page = page;
mc.shiftX = shiftX;
swfPages[page] = mc;
}
addPage(menu_mc.buttonHome_mc, '/', 0);
addPage(menu_mc.button1_mc, '/page1/', -50);
addPage(menu_mc.button2_mc, '/page2/', 50);
// Set button functions
buttonFunction = function(button) {
button.onRelease = function() {
changePage(this);
SWFAddress.setValue(this.page);
}
button.onRollOver = function() {
SWFAddress.setStatus(this.page);
}
button.onRollOut = function() {
SWFAddress.resetStatus();
}
};
buttonFunction(menu_mc.buttonHome_mc);
buttonFunction(menu_mc.button1_mc);
buttonFunction(menu_mc.button2_mc);
// Page Change Function
changePage = function (swfAddressValue) {
var button = swfPages[swfAddressValue];
var toX = menu_mc.homeX + button.shiftX;
TweenMax.to(menu_mc, 0.5, {_x:toX});
};
SWFAddress.onChange = function() {
changePage(SWFAddress.getValue());
}
Everything works as expected in the swf file, and when you hover over the buttons you can see the correct URL show up in the status bar - but when you click, the URL doesn’t change.
Not sure what I’m doing wrong… Thanks for any help you can give me