Thank you for pointing to this EC function.
But I persist in not completely understanding your very interesting question Could you explain (may be give an example) why you need that kind of access by instance name ?
All that came to my mind since you have initiated that thread is to either use
1) a variable pointing to that particular instance : when you are at instantiating it, instead of giving it a name, isn't it simpler to store it in a global variable ?
or 2) an array of all instances, but we still need a variable to store the index of the particular instance.
What bothers me in the three tracks you've considered
3) "tagging" the instance by giving it a proper class
4) array of objects having a name property
is that in both cases you need a traversal to recover the instance : in 3) the traversal is hidden under a jQuery selector (or a find()) ; in 4) you need to explicitly traverse the array via a for loop (or each()).
This contrasts with a variable that will give you access to the instance without the need of a traversal. But surely I miss something
PS : with the EC function getSymbolName(), it seems that we also need a traversal.
Gil, I agree with all you said. I ended up using 2) to manage my situation. 3) & 4) add too much complexity and 1) too many variables. I don't like to use global variables, so when I need to use a variable everywhere, I prefer to store it into a symbol variable instance that I know will persist (the stage, maybe) and recover it when I need it.
The true reason I asked for the "name" function, was more a matter of consistency within the Edge API than a no-way-out problem. It's just annoying you can get a symbol manually added to your edge animation by its "name" using .getSymbol(), but there is not an easy way to use that function with a dinamically created symbol cause edge doesn't "give" you names when you create symbols dinamically. Edge must assign a name to any dinamically created symbol but, which one?
I just want to use .getSymbol() for both, manually and dinamically created symbols. I used Chrome code inspector to see the structure of a symbol object, and found the "name" (or ID) assigned by Edge to a dinamically created symbol...
mySym.aSymbolInstances will give you an array with all "names" when you create symbols with .createChildSymbol(). If you just created one symbol, then mySym.aSymbolInstances will return its "name" (ID), something like this: #eid_1379485757227_mySymType
store it into a symbol variable instance that I know will persist (the stage, maybe)
Looks like a global variable
It's just annoying you can get a symbol manually added to your edge animation by its "name" using .getSymbol(), but there is not an easy way to use that function with a dinamically created symbol
May be are you also an AS3 coder used to search through the display list accessing display objetc containers either by index (getChildAt()) or by name (getChildByName()).
mySym.aSymbolInstances will give you an array with all "names" when you create symbols with .createChildSymbol().
Thank you for this helpful information. I didn't know about it.
"name" (ID), something like this: #eid_1379485757227_mySymType
For a manually instantiated symbol symB, nested in symA, itself instantiated in the Stage Symbol, the fully qualified name (ID) is Stage_symA_symB.
It's useful to write a global function for the behavior (on click for example) shared by a group of buttons, provided you adopt a naming convention btn1, btn2, etc. Passing the event objet to that function, you can then recover the number of the clicked button via
This abstraction avoids duplicating the same code (differing only by the button number) on each button.
Why not give an id to your created symbols?