That's right. "_name" is a property of a movieclip object which is set the time you create
and instance of a movieclip.

When creating a generic object, it doens't have a _name or name property, unless
you give it one.

So, you could do this:

var fooObj:Object = new Object();
fooObj.name = "...." // whatever

But as Danny said, the variable that holds the object has absolutely nothing
to do with the name of the object. That goes the same for movieclips.

You can do:

var mc:MovieClip = _root.createEmptyMovieClip("myClip", 100);
var movie:MovieClip = _root.myClip;
var clip:MovieClip = mc;

All three variables refer to the same movieclip object. Which is the name of the movieclip?
Is it "mc", "movie", "clip" or "myClip"?

It's the last one, "myClip", because you set it when creating the instance in the first place. No matter which variable holds a reference of the movieclip object, it doesn't affect the name property of the movieclip.

I hope this helps.

Dimitrios


----- Original Message ----- From: "Danny Kodicek" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Monday, January 23, 2006 3:43 PM
Subject: Re: [Flashcoders] getting the name of an object



hi,

this might be obvious but how do I get the name of an object? If I got an object named fooObj how can I get Flash to for example trace out the name of the object, so that it traces "fooObj"? I know this works with movieclips but how about objects or arrays?

Objects or arrays don't have a name. That is: you could have a variable fooObj referring to some object O, and you could set another variable barObj to refer to the same object. The object O is completely independent of the variables referring to it. For that matter, an object held in an array doesn't even have a variable name referring to it. So unless you set up some kind of convention of your own, the request doesn't really make much sense.

Danny
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to