Kévin Duguay
Kévin Duguay

Reputation: 761

How to change the width and height of my stage dynamically in AS3

I've been reading alot of question and I found how to change de the width and height of my stage in AS3:

[SWF(backgroundColor="#000000", width="200", height="400", frameRate="29")]

The only probleme is that I need to be able to change it while my code is running, because when my app start, according on if it's a student or a teacher that use it, the size of the swf will change.

How can I do that?

Upvotes: 0

Views: 1159

Answers (1)

Gurtej Singh
Gurtej Singh

Reputation: 3234

You cannot change the width and height properties of the Stage using code, it is set to what you provide it when the SWF starts. As far as I know, stage.stageWidth and stage.stageHeight are read-only properties.

The dimensions of the stage can be different if you set the scale mode properly and let the user change the size using the mouse, but you cannot reassign them to different values dynamically.

You should ideally look at publishing two separate SWF's if your content and size is different for different users.

Hope this helps.

Upvotes: 1

Related Questions