AS2.0 Q

Out of context: Reply #9

  • Started
  • Last post
  • 10 Responses
  • fyoucher10

    if the argument 'item' is supposed to be the button 'btn_s_1' then just activateItem(btn_s_1). You may have to target the func if you are nested within another mc and your code is in another timeline though (eg. _parent.activateItem(_parent.btn...

    For your example, you may want to look at changing the logic around instead of using a function to determine which button is active. Maybe add a function call which checks which button is the currently active button. For example, create a function which checks a variable and then returns a boolean T or F if the button is the currently active button. Right now, it sounds like ur just adding code to a specific button at a specific time.

    var activeButton:MovieClip;
    isActiveButton = function(thisMovieClip:MovieClip... {
    if(activeButton == thisMovieClip) return true;
    }

    //Then in your button just call this function to check if it shoukld execute whatever code you want.

    myButton.onRelease = function():Void {
    if(isActiveButton(this)) doSomeCode;
    }

    (I'm just woke up so I could totally be wrong).

View thread