views:

107

answers:

2

Hello

I'm creating a simple AIR app with resize-functionality. Of course i need to position a resize-arrow to the bottom-right corner. Here's my code:

stage.addEventListener(Event.RESIZE, handleResize);
function handleResize(e:Event):void{
    resize_btn.y = stage.stageHeight-resize_btn.height;
}

This doesn't work, my button gets out of the window very quickly. How could I make this work?

Martti Laine

A: 

Does it fall out of the window vertically or horizontally?

You might want to set

resize_btn.x = stage.stageWidth-resize_btn.width;

this may be your problem.

jonathanasdf
+1  A: 

I think you forgot to set the stage scale and align modes. Therefore, when you resize, the button goes to the desired Y but as the stage is centered it goes offscreen, giving the idea it's not working.

Try using this:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
MrKishi
Thanks, I had the ScaleMode but not the align.
Martti Laine