Mercy
Mercy

Reputation: 1860

flash components and resizing

I am trying to create a chat program using Flash AS3, and so far, everything is going well, except for when the window is resized, my components are going to cut. I've used:

stage.align = "TL";
stage.scaleMode = "noScale";

Upvotes: 0

Views: 736

Answers (2)

Antoine Lassauzay
Antoine Lassauzay

Reputation: 1607

In order to resize your objects properly, you need to rearrange them when the size of the window changes. For instance, if your chat component must be horizontally centered, your code would like :

stage.addEventListener(Event.RESIZE, resizeHandler);

private function resizeHandler(event:Event):void {
   component.x = (stage.stageWidth+component.width) / 2;
}

If don't want to rearrange them and scale them proportionally, try to set the stage scale mode to other StageScaleMode values.

Upvotes: 0

vulkanino
vulkanino

Reputation: 9124

import flash.display.StageAlign;
import flash.display.StageScaleMode;

...

public function InitializeChatProgram() 
{
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
}

Upvotes: 1

Related Questions