Meghanshi
Meghanshi

Reputation: 91

determining event.target in as2

How to detect on which movieClip an event has fired in as2. I have made a list of duplicate movieclips and want to add click event on each movieclip and distinguish on which movieclip event has fird. I know the solution in as3 but need as2 solution for it. Please, help.

Upvotes: 0

Views: 693

Answers (1)

influjensbahr
influjensbahr

Reputation: 4078

In AS2, when you assigned a function say using myButton.onRelease = myFunction;, within the function you can reference the caller simply using this:

function myFunction() {
 trace(this._name);
}

myButton.onRelease = myFunction; // will trace "myButton" when you click it

Upvotes: 0

Related Questions