How do I know what ..this.. is when I click on the mouse?

I have a tons of dynamically created movie clip on my movie. I’m having trouble knowing which one I’m on. How can I tell which one I’m on when I click on the mouse?

Raymond

Here is the example I’m having problem with:
Synopsis:

(Dont forget to put a button on the movie).

I created 6 dynamic checkbox when I click on the button.

But I would like to know which one I pressed on.

myDepth = 10;

_root.createEmptyMovieClip(“xx2”, ++myDepth);
xx2._x = 0;
xx2._y = 0;

function createMyCheckBox(name, depth) {
xx2.attachMovie(“CheckBox”, name, depth);
}

b.onRelease = function () {
for (i=0; i<= 5; i++) {
zzz = “myCheckBox”;
yyy = zzz +i;
createMyCheckBox(yyy, ++myDepth);
xx2[yyy]._y = i*30;
}
}

////////////////////////////////////////
//OK.
////////////////////////////////////////
zzz = “myCheckBox”;
xxx = zzz +“100”;
createMyCheckBox(xxx, ++myDepth);
xx2[xxx]._x = 300;
xx2[xxx].setValue(false);
xx2[xxx].setLabel(“OK on Trace”);
xx2[xxx].onPress = function () {
trace(“xx2[xxx)].onPress”);
trace(this);
}

////////////////////////////////////////
//NOT OK.
////////////////////////////////////////
xx2[yyy].onPress = function () {
trace(“xx2[eval(yyy)].onPress”);
trace(this);
}

Hello,
Anythis solution yet???

it’s been less than an hour, chill out man

P.S. please use as tags for your code, it makes it a lot easier to read

For those of you interested here is the solution: embed the functionality of each dynamicaly created movieclip inside of the for…loop.
Look at the Bold/Italic/Underline line

myDepth = 10;

_root.createEmptyMovieClip(“xx2”, ++myDepth);
xx2._x = 0;
xx2._y = 0;

function createMyCheckBox(name, depth) {
xx2.attachMovie(“CheckBox”, name, depth);
}

b.onRelease = function () {
for (i=0; i<= 5; i++) {
zzz = “myCheckBox”;
yyy = zzz +i;
createMyCheckBox(yyy, ++myDepth);
xx2[yyy]._y = i*30;
*[U]
xx2[yyy].onRelease = function() {
trace(this._name);

[/U]*

}
}

////////////////////////////////////////
//OK.
////////////////////////////////////////
zzz = “myCheckBox”;
xxx = zzz +“100”;
createMyCheckBox(xxx, ++myDepth);
xx2[xxx]._x = 300;
xx2[xxx].setValue(false);
xx2[xxx].setLabel(“OK on Trace”);
xx2[xxx].onPress = function () {
trace(“xx2[xxx)].onPress”);
trace(this);
}

////////////////////////////////////////
//NOT OK.
////////////////////////////////////////
xx2[yyy].onPress = function () {
trace(“xx2[eval(yyy)].onPress”);
trace(this);
}

For those of you interested here is the solution: embed the functionality of each dynamicaly created movieclip inside of the for…loop.
Look at the Bold/Italic/Underline line

myDepth = 10;

_root.createEmptyMovieClip(“xx2”, ++myDepth);
xx2._x = 0;
xx2._y = 0;

function createMyCheckBox(name, depth) {
xx2.attachMovie(“CheckBox”, name, depth);
}

b.onRelease = function () {
for (i=0; i<= 5; i++) {
zzz = “myCheckBox”;
yyy = zzz +i;
createMyCheckBox(yyy, ++myDepth);
xx2[yyy]._y = i*30;

xx2[yyy].onRelease = function() {
trace(this._name);

}
}

////////////////////////////////////////
//OK.
////////////////////////////////////////
zzz = “myCheckBox”;
xxx = zzz +“100”;
createMyCheckBox(xxx, ++myDepth);
xx2[xxx]._x = 300;
xx2[xxx].setValue(false);
xx2[xxx].setLabel(“OK on Trace”);
xx2[xxx].onPress = function () {
trace(“xx2[xxx)].onPress”);
trace(this);
}

////////////////////////////////////////
//NOT OK.
////////////////////////////////////////
xx2[yyy].onPress = function () {
trace(“xx2[eval(yyy)].onPress”);
trace(this);
}