|
|
|
#1 |
|
Member
Join Date: Jan 2001
Posts: 51
|
How to make an MC know it's own name?
For example, I have a MovieClip that has ten instances. I'd like each instance to be able to tell it's own name and load a different submovie, rather than handcoding each of the 10 MCs.
So the mc with the instance "mc01" would be smart enough to load "subswf01.swf" and so on. Any ideas? Thanks in advance. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
There are a couple ways to do this.
The movie's name is stored in the property movie._name; and you can use string manipulation to extract out the numeric portion. Alternately, you can use the (more efficient) method I often use, which is that when you set up the movie, you assign a number to it, corresponding to the numeric portion of it's name. For example, if you're using a loop:
Then, the movie can always use this.index to retrieve that number and form other names with it. |
|
|
|
|
|
#3 |
|
Member
Join Date: Jan 2001
Posts: 51
|
Exactly what I was looking for! Thanks so much!
|
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|