The web site for Flash ActionScript 3.0 game developers

 
         
   

using mouse to highlight an array of objects

In a game, I want to start with 10 rows of 10 objects. It will be a math game where the player is given a number to represent by using the mouse to surround that number of objects (If they are shown 56, they can either surround 8 rows of 7 objects or surround 7 rows of 8 objects).

Since the "mouse down" would be outside the objects to be chosen and the "mouse up" would also be outside the objects to be chosen, it would seem that having code to determine of the mouse were clicked over one wouldn't work. Since the coordinates of the mouse would be known in either case, I guess that might be used somehow, but I don't know how to determine which objects on the stage would be in the highlighted area (or without figuring the area of each object somehow and doing it that way).

On some old code from an older Flash game I found, "selected" was used when objects were chosen one at a time (which I want to avoid), but I can't find any reference to how that is/was used.



Copyright Gary Rosenzweig