views:

159

answers:

1

Hello.
Is it possible to dynamically (not in the project's options) change the dimensions of the stage by using ActionScript 3? I'd want to create a 400x300px loader, but I also want it to load animations that have bigger or smaller dimensions. I would then change the width and height of the loader to make the loaded animations fit well.
Is there any way to do that?
Thanks.

A: 
<YourLoaderOrContainerWithAnimation top="0" bottom="0" left="0" right="0" width="100%" height="100%" minWidth="400" minHeight="300" maxWidth="400" maxHeight="300"/>

first of all use code.google.com/p/swfobject instead of embed tag, and yes you can directly change sizes like this.width=width_from_js; but as I remember swfobject will allow you to do this in raw js, just check it and let us know. :) thanks

Eugene
Thanks for your help, but that's not exactly what I wanted. I have tested it with a 336x252px loader and 400x300px animation.The loader used the ExternalInterface class to call my Javascript function ResizeContainer(). When the function resized the container, the loaded animation didn't show up correctly - it was just stretched to 400x300, but a big part of it has been left out of the stage.
rhino
add callback from your ResizeContainer to your Loader to change the sizes. Are you using swfobject as wrapper for flash in html?
Eugene
Well, no, I use the <embed> tag with the loader placed directly in it (no Javascript here). "Add callback from your ResizeContainer to your Loader to change the sizes" - so does there exist a way to change the loader's size directly from ActionScript?
rhino
first of all use http://code.google.com/p/swfobject/ instead of **embed** tag, and yes you can directly change sizes like *this.width=width_from_js*; but as I remember swfobject will allow you to do this in raw js, just check it and let us know. :) thanks.
Eugene
Well, I have finally done it. :) I had problems with setting this.width and height so I have searched a bit in Google and I have found another interesting thing - stage.scaleMode. I have set it to StageScaleMode.NO_SCALE and now I just have to change the container's size, nothing more. :) Thanks for your help anyway. And thanks for info about swfobject.
rhino
@rhino you're welcome, don't forget to rate comments and answers and have a happy coding!
Eugene