Okay I have a problem here that is probably basic for most of you. I need to know how to reference variables in other classes. I have been avoiding this by referencing variables from the Main class, where they are created. But at this point I would like to be able to have the option and it would make me a better programmer.
Say I create a movieclip in the Main.as
public var Enemy_mc:Enemy = new Enemy();
addChild(Enemy_mc);
Now in another .as file, Background.as I want to tell the Enemy to move to the right:
Enemy_mc.x += 5;
How do I do that^ without creating a variable in Main.as and having it check Background.as for variable updates?
Can I do something like “Main.Enemy_mc += 5;” like I can do in Main.as to variables that I have created in Main in other classes?
Thanks!