I have a button, that's a class, say, Button. And a main document(class Main) where I can see all the changes in a text field, refreshed every frame (yeah, I don't like trace()). The button has a function of changing a variable that's used in main file. So when I press the button, that I add in the main file to the stage, I need it's function to work. Button class has this.addEventListener(MouseEvent.CLICK,function), further function adds to the var from main class. So if it did add, I would see the changes in the text field. I see changes made by an object I add directly, in the graphic editor, but no changes from the button, whose child I add. Variables are public. Functions are all public. So...
Classes cannot exchange variables freely?
How do I change a variable via a function in a different class?
Maybe I need to export and import var? I thought they all work as a united program that shares all public variables.
Main: I create var i, add Button child to stage and show i every frame =D
Button: When you press me, I add 1 to i =D
SherWood: Main, Y U don't show i, changed by Button? T_T
Code example: