-
Using Flex Builder - setting stage width/height
Hi there,
I have recently started using Flex Builder for my Actionscrtipt 3 projects because it is has a much better text editor and is designed around the eclipse framework. However I am having trouble with what should be a simply task.
Flex builder compiles a swf for me from my main application file which is just an .as file. I therefore cannot put a variable reference on my main timeline and pass it through to any of my classes(cannnot do this on main timeline):
Code:
var _stage:Stage = this;
I can acess the stage in one of my classes in order to add a child but cannot set the width and height and Flex seems to automatically compile my swf at 550 * 400.
Code:
public function PropShop(){
nav = new Navigation();
stage.scaleMode = "noScale"; //does work
stage.align = "B";//does work
stage.stageWidth = 990; //not working
stage.stageHeight = 720; //not working
stage.addChild(nav);//does work
}
This is the constructor for my main application class where I would like to initially set the stage width and height. I'm pretty sure you cannot dynamically change the stage dimensions once the swf has been compiled but I don't know how to go about changing them beforehand.
Hope you can help,
Regards,
Gareth.
Last edited by gaffafoote; 03-17-2008 at 11:25 AM.
-
ʞ33ƃ
You can do it using the SWF meta tag. It must be directly before your main class definition.
code:
[SWF(width="800", height="600", backgroundColor="#ffffff", frameRate="30")]
http://blog.davr.org/actionscript3-q...properties.etc
-
Thanks for this. Unfortunately I think this metatag might only work in a Flex project. I'm am running a Actionscript project in Flex Builder. Flex builder 3 is compiling a swf from my main-application file which is a .as file. Thus if i put your meta tag infront of the main class definition it errors.
Does this make sense or am I entirely wrong?
-
Apologies, this has worked. I was being a plank. Thanks.
-
Senior Member
Also, mxmlc has command line parameters for setting many of the stage attributes (size, background color, framerate).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|