I have a series of 4 objects (object1, object2, etc) and 4 empty boxes (box1, box2, etc). What I want to happen is this:
1) Click the object and all empty boxes light up
2) Click an illuminated box and the object moves to it and it along with the now occupied box can no longer be acted upon
And repeat the process until all empty boxes are occupied in a 1:1 ratio (that is, 1 object per box and no objects can overlap).
I have honestly no clue where to begin coding this idea. Can anyone help?
You want to assign variables for each object and each box that keep a status of the objects and boxes in terms of being used already. You have another couple of variables to use to indicate which items are selected (selectedObject, selectedBox).
When you click on an object whose used status as false, it calls a function that lights up all boxes whose used status are also false, and assigns itself as the value of the selectedObject.
The lighting of the box would essentially be the box advancing to a frame that shows the lit visual OR making some invisible movieclip of the box visible. When you click one of the boxes, its used variable gets set to be true, the selectedObject's used variable gets set to be true, a function is called to reset all the boxes to an unhighlighted state, and you set the selectedObject._x and _y properties to equal the _x and _y properties of the selectedBox (you could instead use an actionscript Tween if you want to animate the movement to the box). Lastly, you set the selectedObject and selectedBox values to null or some other essentially unassigned value.