Programmatically Setting Stage Width/height

how do i programatically adjust the height and width of the stage in Flash CS3 using actionscript ?
Who is Participating?
ccareyConnect With a Mentor Commented:
if you're running in a browser you need to put the SWFinside a container (eg <div>), set the embed size to 100% width/height and then resize the DIV (using javascript) to change the stage size.

You will need to set the stage scale mode to 'no scale' as follows:


import flash.display.StageScaleMode;
import flash.display.StageAlign;
stage.scaleMode = StageScaleMode.NO_SCALE; //set noscale
stage.align = StageAlign.TOP_LEFT;         //optionally set the alignment of the content inside the SWF

Open in new window

whatisittellmeAuthor Commented:
i think you got my question wrong. or may be i dint put it correctly.
when i press ctrl+enter on my .fla file, swf file plays. i want to adjust the size of the output swf programatically.
(usually, by varying number of pixels in properties window of document class, i will be able to change the width and height of the output swf. but i am not sure how to achieve this via actionscipt3.)

What's the end publish format? Are you trying to make a projector or something that you will eventually run in a web page?
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

whatisittellmeAuthor Commented:
i will be running it in a webpage eventually.
You're best off using the method I posted earlier in that case. You'll need to manually resize (drag) the container if you're testing inside the authoring environment as there's no way to programatically set that.

At runtime, use javascript to resize the DIV containing the swf.
whatisittellmeAuthor Commented:
thank you, that helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.