LIB or Sen Please Help... XML Navigation

Guys, I promise this is my last question regarding the XML nav you guys made

I want the navigation to expand onRollOver not onRelease.

When i change it it doesn’t work, why not? This seems so simple but yet it won’t work

here’s some code


						mySubButton.onRollOver = function() {
							getURL(this.myUrl, this.myTarget);
							trace(this.buttonLabel.text+" : "+this.myURL);
						}
						mySubButton.onRollOver = function() { this.glare.play(); }
						mySubButton._x = this._x;
						mySubButton._y = this._y + vSpacing*(j+1);
						mySubButton.arrow.swapDepths(0);
						mySubButton.arrow.removeMovieClip();
					}
				}
				
				myButton.onRollOver = function() {
					if (mainMenu.currentSubMenu != this){
						mainMenu.currentSubMenu.arrow.setToRotateTo(0);
						mainMenu.currentSubMenu = this;

						var currButton = this;
						mainMenu.onClosedMenu = function(){ 
							this.offset = vSpacing * currButton.subMenus;
							this.dropStart = currButton.ID;
							this.currentSubMenu.createSubMenu();
							currButton.arrow.setToRotateTo(90);
							}
						mainMenu.offset = 0; 
					}else{
						mainMenu.currentSubMenu = null;
						this.arrow.setToRotateTo(0);
						mainMenu.offset = 0; 
					}
				}
			}else{
				myButton.myUrl = menuItem*.attributes.URL;
				myButton.myTarget = menuItem*.attributes.TARGET;

				myButton.onRollOver = function() {
					getURL(this.myUrl, this.myTarget);
					trace(this.buttonLabel.text+" : "+this.myURL);
				}
				myButton.arrow.swapDepths(0);
				myButton.arrow.removeMovieClip();
			}
			
			myButton.onRollOver = function() { this.glare.play(); }
			myButton._x = 3
			myButton._y = -2; // position
			myButton.homePosition = myButton._y += vSpacing*i;
		}

Thank you in advance

Look at your script, you have 2 onRollOver handlers.

So the second one that gets called (this.glare.play()) overwrites the first one (produce menu code)

lol woah, did i miss that part in Flash 101? why can’t i use the same handlers more than once?

anyway thanks a lot man.

Digitalosophy Tip’s Hat

Dynamic event handlers are functions, so when you define what happens in 1 function and then create a new function with the same name it overwrites the original function to make way for the new function.

Example…

[AS]function test() {
trace(2);
}
test();
//returns 2[/AS] but [AS]function test() {
trace(2);
}
function test() {
trace(9);
}
test();
//returns 9[/AS]

it’s as if i told you “when i clap, go left and right”
…what will you do? :wink:

*Originally posted by eyezberg *
**it’s as if i told you “when i clap, go left and right”
…what will you do? :wink: **

LOL… actually that is an awesome example!

actually that was a great example. thanks a lot guys, this is why i love kirupa :slight_smile: