PDA

View Full Version : how to reference an mc in a variable?


Tronik
08-05-2006, 04:55 AM
Hi there - I have a bunch of mc's on my stage, named 'm_page1', 'm_page2' etc. I want to write a function that will dynamically target one of these mc's by passing it an id number, for example:


id=1;

function playMc(id){
mc='m_page'+id;
mc.play();
}



I've got two questions -
1- What datatype should I make 'mc'?
2- In the line 'mc.play();' how do I get flash to recognize that 'mc' is a reference to a movieclip name, rather than being a movieclip itself?

I hope this makes sense, and thanks in advance for taking the time to look at this... :)

Tronik
08-05-2006, 05:03 AM
http://www.actionscript.org/forums/showthread.php3?s=&threadid=17737

Answered my own question. Duh.

oldnewbie
08-05-2006, 05:43 AM
Well I guess CyanBlue actually answered it! ;)