PDA

View Full Version : actionscript noob having problems



Laserbeak43
May 22nd, 2009, 07:46 PM
i'm using actionscript 3 and i've made2 movie clips named mcRect and mcchild(instance name is child2_mc) and i double click it to go into mcRect's scene and type the code into an new layer that says "root.child2_mc.x = 0;" but i get an error saying "1119: Access of possibly undefined property child2_mc through a reference with static type flash.display:DisplayObject."

Brent Summers
May 22nd, 2009, 08:26 PM
What are you trying to do exactly?

Laserbeak43
May 23rd, 2009, 12:32 AM
well i'm reading Nintendo Wii Flash Game Creator's Guide(Pages 86-87), and it tells you to go inside of the scene of an object that you've created. and then use the root keyword to reference an object outside of the object you're currently in. This isn'tworking though.
here's an attachment.

Laserbeak43
May 23rd, 2009, 11:06 AM
:whistle2: (bump)

cbeech
May 23rd, 2009, 03:40 PM
often when working with code from the timeline one needs to 'cast' the reference to root, as in:

MovieClip(root).child2_mc.x = 0;

Laserbeak43
May 23rd, 2009, 11:59 PM
often when working with code from the timeline one needs to 'cast' the reference to root, as in:

MovieClip(root).child2_mc.x = 0;
i don't understand. in my code, root.child2_mc.x = 0;
child2_mc is the target movieclip. so then would i just type child2_mc(root).x = 0; ?

just tried that and it had no effect. did i miss what you were saying?

sebrofm
May 24th, 2009, 01:43 AM
no. MovieClip(root).child2_mc.x = 0;

Laserbeak43
May 24th, 2009, 11:29 AM
ahh i see!! but i'm still not sure why. I have nothing named MovieClip to cast. Oh it's a keyword. Interesting.
Thanks. :)
I'll read up on that