I need help to now how to best add a variable for onPress. My current code for my buttons are below.
I want to use swfobject to control the active state for my flash navigation on a xhtml base website. I thought I just need to put so.addVariable("b1.onPress", "press"); but that didn't work I am missing something. Any help is appreciated.
function over() { if (_global.selectedBtn != this) { this.gotoAndPlay(2); } }
function out() { if (_global.selectedBtn != this) { this.gotoAndPlay(7);
} }
function press() { if (_global.selectedBtn != this) { this.gotoAndPlay(17); } }
function release() { if (_global.selectedBtn != this) { // this prevents you from setting it twice, which is unnecessary (especially if you have an animation playing) this._parent._global.selectedBtn.gotoAndPlay(7); this.gotoAndPlay(18); _global.selectedBtn = this; } }
Variables you pass to a swf from SWFObject are used only at creation time of the swf. It basically adds the variable(s) to the main timeline of your swf on frame 1. Do a Google search on "flashvars", as this is what SWFObject is actually adding for you by implementing so.addVariable().
That being said, if you are completely reloading your HTML page on a menu item click, you can just pass a certain var value to flash to say which menu item should be highlighted etc.
if you passed something like : so.addVariable("section", "portfolio") into your swf (the value of section changes based on the page), you could then add some logic in flash to go to a certain frame/ change text etc.