Groups | Blog | Home
all groups > flash actionscript > july 2006 >

flash actionscript : Button Navigation & Highlight Problem



Tjisana
7/14/2006 7:23:55 PM
I have I believe, a simple button highlight problem. I have a group of buttons
I created on a page and want when button 1 is clicked it stays highlighted
(each button is a MovieClip), and when another button is clicked the last one
clicked gets cleared. All buttons have this initial AS to start:

this.onRollOver = function(){
this.gotoAndStop("focus"); //button changes colour
};

this.onRollOut = this.onReleaseOutside = function() {
this.gotoAndStop("no_focus"); //back to original / starting colour
};

this.onRelease = function() { //here's where I'm stuck - keep the button
highlighted and 'reset' the last one clicked.
this.gotoAndStop("focus");
this._parent.gotoAndStop("Pic2");
this.onReleaseOutside = this.onRollOut = null;
}


Any tips on how to make this work?
Tjisana
7/15/2006 5:05:40 PM
For anyone able to help, I've change the script on my buttons: Some buttons
still act funny - don't reset or only reset on rollOver. Any help?


Tjisana


stop();

var num:Number = 3;

//Mouse RollOver function: change colour when mouse passes over button
this.onRollOver = function() {
if(_global.link != num) {
this.gotoAndStop("focus");
}
};

//Mouse or Pointer Rollout & ReleaseOutslide function: go back to original
colour
this.onRollOut = this.onReleaseOutside = function() {
if(_global.link != num) {
this.gotoAndStop("no_focus");
}
};

this.onRelease = function() {
if(_global.link != num) {
_global.link=num;
for(var i=1; i<=6; i++) {
this._parent["space" + i].gotoAndStop("1");
}
this._parent["space" + _global.link].gotoAndStop("1");
this._parent.gotoAndStop("P3"); //change to new picture
this.gotoAndStop("focus"); //keep button highlighted
}
};
AddThis Social Bookmark Button