AS3: resizing as a result of an eventListener

Posted by Jaimie on Stack Overflow See other posts from Stack Overflow or by Jaimie
Published on 2010-06-16T16:20:44Z Indexed on 2010/06/16 16:22 UTC
Read the original article Hit count: 224

Filed under:
|
|
|
|

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!

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3