I'm hoping someone can tell me what I'm doing wrong here, or help me find a
better way of doing this.

I've got a simple movieClip in my Library set up as Export for ActionScript.
I would like to place several instances of it onstage, and then assign to
each instance some mouse behaviours. The code is as follows:

for (var i = 0; i < 3; i++) {
   var myX = 150 * i;
   var mcName = "myBox_mc" + i;
   this.attachMovie("box_mc", mcName, i, {_width:100, _height:100, _x:myX,
_y:100});
   this[mcName].onMouseDown = function() {
       trace(this);
   }
}
stop();

The instances appear onstage correctly, but I get the same output when I
click on any of the three movieClips:

_level0.myBox_mc2
_level0.myBox_mc1
_level0.myBox_mc0

It seems like clicking on any one of the instances is equivalent to clicking
on all of them.

Where did I go wrong?

Thanks
-edwin
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to