Be a Supporter!

Mcs And Objects That Want To Be Mcs

  • 246 Views
  • 2 Replies
New Topic Respond to this Topic
Lynkusu
Lynkusu
  • Member since: Aug. 27, 2009
  • Offline.
Forum Stats
Member
Level 06
Programmer
Mcs And Objects That Want To Be Mcs 2012-03-27 20:24:34 Reply

I don't actually know if this is possible. But can you make an object equal a movie clip?
Here's what I mean. I have 12 different movieclips drawn out. I have a random number variable and whatever number it generates, I want it to addChild the respective movieclip. The movieclips are all supposed to be called to the same x and y positions, so I was wondering, could I make some object/variable/thing initially equal the movieclip, then addChild that object/variable/thing? Maybe you can't do that, but I'm trying to make my code as clean as possible. xD


Intellectually Questionable? You decide.

Sam
Sam
  • Member since: Oct. 1, 2005
  • Online!
Forum Stats
Moderator
Level 19
Programmer
Response to Mcs And Objects That Want To Be Mcs 2012-03-27 23:27:15 Reply

At 3/27/12 08:24 PM, Lynkusu wrote: I don't actually know if this is possible. But can you make an object equal a movie clip?
Here's what I mean. I have 12 different movieclips drawn out. I have a random number variable and whatever number it generates, I want it to addChild the respective movieclip. The movieclips are all supposed to be called to the same x and y positions, so I was wondering, could I make some object/variable/thing initially equal the movieclip, then addChild that object/variable/thing? Maybe you can't do that, but I'm trying to make my code as clean as possible. xD

You'd store the movieclips in an array and then reference the movieclip through the random number.

addChild(myArray[number]);
Lynkusu
Lynkusu
  • Member since: Aug. 27, 2009
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Mcs And Objects That Want To Be Mcs 2012-03-28 15:02:44 Reply

Well damn. Can't believe that never occurred to me ._. Thanks. xD


Intellectually Questionable? You decide.