Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top