Skip to main content
Participant
December 4, 2009
Question

Question about Object Instance Names

  • December 4, 2009
  • 1 reply
  • 342 views

Hi,

I'm really fascinated at the moment by object instances. By that, I mean the value returned by:

trace(e.target.name); (tried on a MouseEvent object)

or

trace(myTextField.name); (on a textField object).

In my Flash application, I notice that tracing the name of an event object returns "instance26", indicating that this is the 26th (or 27th depending on the base of indexing) object created since the app initialized. Basically what I'm curious about is, firstly, is this instance value subject to change when the app is ported to other platforms (if different versions of the Flash player process instructions in a different order or fashion) and secondly, how can I find what object contains "instance0" or (if the instance indexing begins at base 1), "instance1"?

If anyone has any comments to make, they'd be much appreciated. Thanks a lot.

Kind Regards,

                   Jay.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 4, 2009

instance names are created by flash for displayobjects which have no user-assigned instance name.  they are subject to change any time a new displayobject is added.

i'm not sure what you mean by, "how can I find what object contains 'instance0' ".

you can find instance0's parent by using trace(instance0.parent) and you can use describeType(instance0) to find out everything there is to know about instance0.

but the best thing to do is to assign your own instance names so you don't have to deal with instance0.