views:

296

answers:

2

A silly question, but I spent an hour trying to find it: I created a symbol, and named it symbol_a. How can I get this symbol name from an instance? If I use

myInstance.name

I get the instance name and not the symbol name......

Thanks in advance,

Edward

+1  A: 

I don't think it's possible to get a symbol name using AS3.

Btw. why do you need it really?

Michal M
Hi, I need it because I am creating a map with 20 areas (thus 20 symbols) in it. These areas change in color/function during the timeline, about 30 different dates. But with my customer Stupid as I was, creating those 30 different dates, I forgot to name them in the beginning. And I created also some comments at that time, so I couldn't rely on the instance names (instance1, instance2, instance3 etc). So I thought, well, I don't know the name, but I do know the symbol which I used......
+2  A: 

Hi,

This will return the name of the "symbol" (String).

getQualifiedClassName(yourSymbolInstance);`

This will give you the Class Object of your instance.

var c:Class=yourSymbolInstance.constructor;
addChild(new c());

If you don't export your symbol, the symbol name will be MovieClip.

OXMO456
Yes this works as long as you export the symbol for ActionScript as you are extending the MovieClip class to a new class that you specify which defaults to the name of the symbol. The name of the symbol itself is a Flash thing used to organise the library. It has no relation to ActionScript.
Allan
Oh you're right !!! well i need to read more carefuly the questions : |
OXMO456
It still does kinda work, an innovative hack :)
Allan