Question

for you experts, i do have a question,

please take a look at this file,

i need to extract “i” when mouse is down,

how do i get to 1,2,3 instead of 4?

thanks.

Try this…

for (i=1; i<=3; i++) {
	_root["a"+i].onMouseDown = function() {
		trace("i is : " + i + " : " + this._name.substr(1));
	};
}

I am not getting 1, 2, 3 from i, rather getting it from the instance name a1, a2, a3…

for (i=1; i<=3; i++) {
_root["a"+i].i = i;
_root["a"+i].onMouseDown = function() {
trace("i is: "+this.i);
}
}

:wink: =)

the objective is to extract which movie clip has been selected.

how do i display only the mc that was selected?

both samples provided generate 1,2,3.

for a1, if mouse is down, i am interested in i display 1.

for a2, display i=2,

… etc.

for (i=1; i<=3; i++) {
_root["a"+i].i = i;
_root["a"+i].onRelease = function() {
trace("i is: "+this.i);
}
}

that was your mistake… not cyan’s, not mine :-\

use the onRelease or onPress handler instead :wink:

MovieClip.onMouseDown
MovieClip.onPress
MovieClip.onRelease

=)

:wink:

thank you:)

_root[“a”+i].i = i;

is this an acceptable way to determine which clip(i) is selected?

thanks!

no problem :wink: =)

and…

Originally posted by ping
is this an acceptable way to determine which clip(i) is selected?

i think it’s a good way. there may be an easier way, there may be a harder way though. :stuck_out_tongue:

What about this??? Using the instance name again so that I won’t be creating another variable… :wink: Yes… That is acceptable too…

for (i = 1; i <= 3; i++)
{
	_root["a" + i].onPress = function()
	{
		trace(this._name.substr(1));
	};
}

trace(this._name.substr(1));

_root[“a”+i].i = i;

thanks for the lesson… :slight_smile:

is it necessary for me to download these messages for future reference or does kirupa save all my forum messages?

hey cyan =)

i assume that a1, a2 and a3, is just for testing.
that’s why i decided to create the variable instead :wink:

and ping

all these messages will be here. don’t worry about that :wink:

Oh, okay, kax… :wink:

That’s how I usually name my instances though… Usually make me save some additional headaches… =)

Originally posted by CyanBlue
**Oh, okay, kax… :wink:

That’s how I usually name my instances though… Usually make me save some additional headaches… =)**

me too… sometimes. :stuck_out_tongue:

i store my instance names in an array :wink:

:wink:

yup =)