Andrew Willis
Andrew Willis

Reputation: 2349

Flash AS3: Resize SWF but keep elements the same size

I am trying to create a fullscreen chat program using Flash AS3, and so far, everything is going well, except for when the window is resized, the whole thing is proportionally resized.

I would like it to ONLY resize the chat text area, when the resize is done vertically, keeping the controls the same height consistently, also I would like the buttons for sending the chat to maintain their size, with the input box increasing in width when the size is increased horizontally.

Obviously the SWF resizing will be done by JavaScript/jQuery .onResize() and thus I will be able to set a mimimum width and height for the swf, maintaining usability.

Is there any way to do this?

Upvotes: 0

Views: 1005

Answers (1)

Cay
Cay

Reputation: 3794

Stage's resize event triggers every time the swf changes size, so you don't need to use ExternalInterface (it's less reliable and adds complexity). Also, you should set stage.scaleMode to "noScale" and stage.align to "TL" so the elements won't scale (you will do that manually) and they will be aligned to the top left corner (to maintain consistency with the display list).

Then, on each resize event you can check the new dimensions (stage.stageWidth and stage.stageHeight) and resize/relocate your elements individually (e.g. chatBox.height = stage.stageHeight)

Upvotes: 3

Related Questions