0

I basically have this

enter image description here

and what I need to do, is when the user clicks on one of those boxes on the right, it'll appear in the yellow box on the left.

Each of those right boxes will be unique with different graphics. It'll basically be different graphics to be displayed on a T-shirt, which will be represented by the big black square.

Now I know that each of those graphics should be a button symbol with mouse click event, but I'm not really sure how to handle the event.

Should I just create a clone of that item and move it to the target area? Or is it possible to create some kind of blank placeholder where I could just display it?

4 Answers 4

1

The simplest solution is to just display it like you suggest. Here are the steps to get that going:

  1. Place a Bitmap object in the yellow
  2. Create A BitmapData object of the size of the yellow area, and feed it to the BitmapData property of your Bitmap.
  3. Use the BitmapData.draw() function of the BitmapData Object to make a visual snapshot of the blue and green areas. Like myBitmapData.draw(blueAreaDisplayObject);
  4. Profit.
1

Go through this small game here. I am indeed swapping objects in Actionscript.

0

Just give it a class name in your library then attach/remove clip from the library using a loop and giving it an id. Your mouse event will give you access to event.currentTarget, then you can call the id setter/getter to know the id of the tile that has been clicked. You can then attach/remove tiles from the library.

If you don't know how to do that, i suggest you visit www.kirupa.com to start learning proper AS3.0, that should get you on the right track.

0

Make class that stores the original position of the movieclip, and make two functions, one that allows you to move back to the original position and one that allows you to move over the shirt.

var currentShirtMC:MC; //current item on shirt   

//this event listener should added to every MC
function md(e:MouseEvent){
  currenShirtMC.moveBack();

 MC(e.target).moveTo();
 currentShirtMC=e.target; //e.target is the movieclip being clicked
}

This code will break if you don't have an object defined in currentShirtMC...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.