Skip to main content
Participant
November 26, 2008
Answered

How do I name a MovieClip drawn with as3?

  • November 26, 2008
  • 3 replies
  • 410 views
I am trying to draw a set number of squares in a grid type layout and have pretty much gotten it to do what I want. The problems is that I want to be able to manipulate each square individually later on and I'm pretty sure I need to assign each one a unique instance name... something like "square_0_0" all the way down to "square_10_10" (it's a 10x10 table of squares).

Anyway... how do assign a unique instance name to each square as it's added to the stage? I attached the code I currently have running. Thanks in advance for any help you can offer.

This topic has been closed for replies.
Correct answer kglad
movieclip's have a name property that you can assign:

shape.name = "shape_"+c+"_"+r;

3 replies

kglad
Community Expert
Community Expert
November 27, 2008
you're welcome.
Participant
November 26, 2008
booya!

I have been trying to figure this out. I was getting pretty angry because it seemed so freakin simple.

Thanks a bunch!!!!
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 26, 2008
movieclip's have a name property that you can assign:

shape.name = "shape_"+c+"_"+r;