开发者

Stick element to bottom-right corner (AS3 - Adobe AIR)?

开发者 https://www.devze.com 2022-12-26 07:14 出处:网络
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:

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 开发者_Python百科window very quickly. How could I make this work?

Martti Laine


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;


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消