First post!
Been searching the boards/web for a couple days now looking for an answer to the following. Apologies if this has already been answered previously. And I’m new to ActionScripting in general, hence the lengthy explanation.
I have an .fla, DocumentClass.as, Ball.as and Buttons.as all in the same folder. The Document Class:
- Creates an instance of Buttons, gives it an x/y position and adds it to the stage
The Button Class: (assigned to a MC in my library)
- Has an event listener that listens for a mouse click
- When clicked, the button creates an instance of Ball, gives it an x/y position and adds it to the stage (instance name is _ball)
- Then calls a function Go(); which is in the Ball class ( e.g., _ball.Go(); )
The Ball Class: (assigned to a MC in my library)
- The Go(); function is called successfully from the button mentioned above (traces to the output panel)
THE PROBLEM
- I also want to Go(); function to update the position of the instance _ball, but the instance isn’t recognized within the class Ball.
(if I try _ball.x = 100 I get, 1119: Access of possibly undefined property ball through a reference with static type flash.display:Stage.)
How would one go about doing this?