0
votes

I'm new to actionscript 3 and I'm trying to get a few simple things going, such as setting variables in other movieclips... So let's say I have an "apple" movieclip on the root/stage, and I want to access other variables on the root, or in other movieclips. How would I do that? In actionscript 2, I would use something like

_root.thisVar = 1;
_parent.thisVar = 1;

and with other movie clips I would use

_root.apple2.thisVar = 1;
_parent.apple2.thisVar = 1;

I'm confused because from the stage, I can access all the variables and functions inside other movieclips on the stage, but I can't go in the opposite direction.. anyways, any help would be appreciated, thanks.

1

1 Answers

0
votes

It's best to place all of your actions on one keyframe, at the stage level. That way when you try to target a variable you don't need to worry about working your way back up the display list to target something at the root of the stage. In AS2, it was sometimes common to place actions directly on a MovieClip but this practice is no longer possible in AS3 and for good reason.

A couple other things to note: in AS3, you now refer to an objects parent with 'parent' and not '_parent'; Only MovieClips can have dynamic properties unless you subclass Sprite and make your own class.