0
votes

I am trying to reference a movie clip through its instance name which I have called "mc_mycursor" inside flash.

I want to access this movie clip inside my main document class which runs the entire application. Till now I have been exporting all objects on my stage to classes and then adding them as child objects to my stage which works fine but I would like to know how to directly refer to an object inside stage in AS3 just by using its instance name.

I have declared the variable in my main doc as follows

private var mc_mycursor:MovieClip;

but when i try to do something like mc_mycursor.x = 500, it throws an error. I am new to Flash so some help would be appreciated.

1

1 Answers

1
votes

You first need to instantiate it like:

mc_mycursor = new MovieClip();
addChild(mc_mycursor);

You can do this in the constructor or at least before you try to modify properties.