Question

How to fix a text field width and height as well as its position when air window re-size in flash action script with air? I am trying to use text field like as notepad editor area but when when i re-size adobe air window the text field property automatically adjust ,mean it change its position . i want that when the width of air window re-size, text field should adjust its width according to adobe air window width .when the height of air re-size the text field should adjust it's height according to Adobe Air window height and text field position(x,y) should fix.

Was it helpful?

Solution

For controlling resize of components, in the beginning of application configure stage:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

Subscribe for resizing of the stage, and implement resize of TextField:

stage.addEventListener(Event.RESIZE, onResize);

function onResize(e:Event):void {
    //Implement logic, screen size is (stage.stageWidth x stage.stageHeight)
    const padding: int = 20;
    myTextField.width = stage.stageWidth - 2*padding;
    myTextField.height = stage.stageHeight - 2*padding;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top