AS3: resizing as a result of an eventListener
- by Jaimie
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 try. 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!