views:

73

answers:

1

Hi everyone,

I have coded a map that when a province object is clicked on, it should move to the center of the screen and grow a percentage of the width, along with displaying a number of different things.

The problem is that in order for the image to resize it needs to be clicked on twice. It moves, and all of the children display just as they were designed to do, but the resize doesn't work on the first click. Any ideas how to fix this problem?

menuItem4_mc.addEventListener(MouseEvent.CLICK, onClick);

public function onClick(mc:MouseEvent):void { 
   menuItem4_mc.width = width * .65;
   menuItem4_mc.height = height * .7;

   //brings Ontario To the front of the stage
   setChildIndex(menuItem4_mc,numChildren - 1);

   menuItem4_mc.x= 670/2;
   menuItem4_mc.y= 480/2;

   ...
}  

Thank you!

A: 

First try moving the positioning statements (referring to x and y) above the width and height statements. This might work.

If it doesn't, try referring to the stage's width and height when assigning, instead of the container movieclip's. I'm assuming that the container has the same dimensions as the stage.

danyal