50 movieclip in same time

I dont know if anyone can help me. Im making a scratch card…(its not important what it is…) i’ve got 50 things to scratch, i’ve made a movieclip for one with the following actions :

onClipEvent (mouseDown) {
tellTarget ("/apple") {
play ();
}
}

It work,but the thing is, i want to use the same movieclip for the other 49… if i duplicate the movieclip,when i click on one they all play…how i do for when i click one,just this one play?

Thank you very much

that’s because they all have the same instance name of “apple,” you would have to give them individual instance names like “apple1”, “apple”…etc. Also make sure you change the corresponding actions as well for example movieclip with instance name “apple1” would have this action on it:[AS]onClipEvent (mouseDown) {
tellTarget ("/apple1") {
play ();
}
}[/AS]

yeah i thought of that one but it dosen’t work…i really don’t know why…maybe its not the right action…

well, we are also not using telltargets anymore. The new format for the code is much more simple. Secondly you need a test to see which of the buttons your mouse is over.

onClipEvent (mouseDown) {
apple.play();
}

is the current method of calling to the movie clip “apple” and telling it to play.

a hit test is pretty easy when you’re doing a mousedown, and with a “for in” loop you can easily move through every movie clip on the stage. I think it would look something like this.


onClipEvent (mouseDown) {
    //this cycles through _root, finds an object, and applies everything in the brackets to that object.
    for(obj in _root){
        //this takes that object and applies a hit test to it.
        if(_root[obj].hitTest(_root._xmouse,_root._ymouse,true);
            //this tells the object to play
            _root[obj].play();
        }
    }
}

this assumes that all of the movie clips “apple” are all on the root timeline.