hilly
hilly

Reputation:

effcient Event dispatchinging in Actionscript 3

I have 6 instances of a moiveClip. when one is clicked, i need to write a function that affects all other instances of the movieClip, and not affect the one being clicked.

What is the most efficient way of doing this? Im thinking something to do with event class for sure.aa

Upvotes: 0

Views: 69

Answers (1)

Sean
Sean

Reputation: 509

Put a single event handler on all of them and do something like this:

private function onClickMovieClip(event:MouseEvent):void
{
    for (/*run through your clips*/)
    {
        if (event.target != /*current clip*/)
        {
            doSomething();
        }
    }
}

Upvotes: 3

Related Questions