Is this a Recursive Function? Help please

Hello all,

I have a movie with 5 buttons in it. Now, when a button is rolled over, it has an on state, and when clicked, it has an inactive state. Instead of writing alot of redundant code, I’m trying to see if I can simplify it. Here is what I have:

//active/inactive
function active (navClip) {
if (this.hitTest = true) {
navClip.onEnterFrame = function () {
this.enabled = false;
};
} else if (this.hitTest = true) {
navClip.onEnterFrame = function () {
this.enabled = true;
};
}
}
// button code
myBtn1.onRelease = function () {
active (myBtn1);
goToAndPlay some clip I have on stage
};

myBtn2.onRelease = function () {
active (myBtn2);
goToAndPlay some clip I have on stage
};

All AS is in the root, first frame. Any help would be GREATLY appreciated!!

Many Thanks in advance!

J

Well, to answer the question, no that is not recursive… A recursive function basically calls itself repeatedly until something stops it… I’m not entirely sure what you’re doing, but this might help:

[AS]var selectedButton:MovieClip;
//
function buttonAction(buttonPressed:MovieClip, mcToPlay:MovieClip, frameToPlay:String):Void {
selectedButton.enabled = true;
buttonPressed.enabled = false;
selectedButton = buttonPressed;
mcToPlay.gotoAndPlay(frameToPlay);
}
// button code
myBtn1.onRelease = function() {
buttonAction(this, some_mc, “myFrameLabel”);
};
myBtn2.onRelease = function() {
buttonAction(this, someOther_mc, “myFrameLabel”);
};[/AS]

Also, be sure to watch the difference between the assignment operator and the equality operator when writing your scripts… it’s tricky…

This works great, Thank You. It doesm’t seem to send the ‘myBtn’ clips back to their default speces… in other words, they stay on “[COLOR=#FF0000]myFrameLabel” [COLOR=Black]once they’ve been clicked…

Again, Many Thanks
[/COLOR][/COLOR]