I’m creating a game where balls bounce off lines that are drawn by the user (using Flash8/AS2.0). I have one class instantiated at run-time that creates a little toolbar to draw lines. Inside this class is the call to instantiate the ‘line’ class, where a new instance of the ‘line’ class is created whenever a new line is drawn. I have seperate classes for creating balls using the same method, where one class creates the toolbar for creating balls at run-time, and then balls/ball-classes are instantiated with certain properties from inside this class.
I need to create a listener in the ball class that runs whenever a new line is created so that I can set an interval for bouncing the balls off of the lines. The problem is that when creating a listener I need to reference the instance of the class where the broadcast is coming from, and I don’t know how to reference these classes because they are not created when the program first runs and don’t (at least as I can see it) have public instance names.
I’m currently using the EventDispatcher methods. Does anyone have any suggestions as to how I can accomplish this, even by another method…i’m at a loss.