Duplicate movie clip instance naming

Hi, I’ve got a movie where I duplicate a Button a bunch of times using the DuplicateMoiveClip command. This works fine and dandy.

however I now need (on the rollover) for each button to know its name, but “_name” gives the name of the instance, and since these buttons were created dynamically, the instance name is not created. And when a Trace is put on the “_name” on the rollover state of the generated btn it gives me the name of the movie clip that the button is in (so all the buttons have the same name)

1- is there some way to define the instance name of a generated symbol?

2- can I pull the name from the actuall name of the symbol?

or have I missed something…

thanks!

-Mopie

can you be more detailed or give an example?

Ok this is the code for creating the Buttons (it takes the first button, duplicates it, moves it over 10px, does this till the row is full, then continues till the grid is full… and it works lovley)

btn_xpos = 5.5;
btn_ypos = 5.5;
growth = 1;

function place_btns(){
duplicateMovieClip(“btn”,“btn”+growth,growth);
this[“btn”+growth]._x = btn_xpos;
this[“btn”+growth]._y = btn_ypos;
btn_xpos = btn_xpos + 10;
if (btn_xpos >= 105.5){
btn_ypos = btn_ypos + 10;
btn_xpos = 5.5;
}
}

for(i=1; i<=70; i++){
growth ++;
place_btns()
}

What I need is when you rollover the newly made buttons, I need it to know who it is…

if I use this code

on (rollOver) {
trace(this._name);
}

I get the name of the instance for the movie the buttons are in

if I use

on (rollOver) {
trace(_name);
}
I get the same thing

how can I get the property of the name of the button that I’m rolling over?
getProperty(this,_Name);
also gives the name of the movieclip that they reside in, not the button.

(keeping in mind that these buttons are created with the duplicate clip function, so I cannot give them an instance name (or if I can I dont know how to)

thanks in advance

-Mopie

You use a dynamic event handler instead.

function place_btns() {
	duplicateMovieClip("btn", "btn"+growth, growth);
	this["btn"+growth]._x = btn_xpos;
	this["btn"+growth]._y = btn_ypos;
	this["btn"+growth].onRollOver = function() {
		trace(this._name);
	};
	btn_xpos += 10;
	if (btn_xpos>=105.5) {
		btn_ypos += 10;
		btn_xpos = 5.5;
	}
}

thanks!

No problem. :wink: