PDA

View Full Version : problems with "this" and "_parent"



contrast
August 18th, 2005, 08:42 AM
I have a simple class that I created. It was working fine then stopped for no reason that I can tell.

I have it trace the value for "this", then I have it trace the value for "_parent", here is what I get:

this = _level0.instance1.instance2.nav001
_parent = undefined

Shouldn't _parent = _level0.instance1.instance2?

This is the root of my probelms since I use this class to change the _x and _y values of the _parent._parent.

Has anyone seen something like this before? It is very frustrating.

Thanks for any help.

senocular
August 18th, 2005, 08:45 AM
the only thing I can think of is that you didnt extend MovieClip

Ouzo
August 18th, 2005, 08:56 AM
Hi,

Try to use this._parent cause the class doesn't have parent, but something you create inside that class does have, so you have to put this (reference to that something created with that class) then reference thats parent with this._parent.

That should work.

Cheers,
Ouzo

contrast
August 18th, 2005, 09:00 AM
That did it, I didn't extend MovieClip, thanks!

senocular
August 18th, 2005, 09:01 AM
Are you using AS 1?

contrast
August 18th, 2005, 09:03 AM
Are you using AS 1?

No, I am using AS 2, MX 2004, non-pro, for now until I get studio 8.

senocular
August 18th, 2005, 09:13 AM
ok, just curious ;)