-
How to resize an image depending on the browser size? - pls help
Hi
I'm wondering how to resize a background image depending on the browser window size, so that the user always can view 100% of the image. But it should be proportional scaling.
You can view a perfect example of this over at http://www.puma.com/
The effect I want is that the background scales dynamically dependeing on the browser window size but the size of the content stays static.
I have no problem setting the size of the content static using listeners with Stage.scaleMode = "noScale";
But I have no idea on how to scale the background image (MC) proportionally depending on the browser window size.
Any help would be appreciated
Thanks
-
Flash Gordon
first you need to make sure, that the flash fills all of your browser window,
then inside flash you might use this code:
code: Stage.scaleMode = "noScale"
var myListener:Object = new Object();
myListener.onResize = function () {
trace("Stage size is now " + Stage.width + " by " + Stage.height);
}
Stage.addListener(myListener);
// later, call Stage.removeListener(myListener)
Btw. this code is taken 1:1 outta flash help about "onResize"
-
yep flash fills the browser window
I saw that example code in the help section. that code just traces the width and height of the stage.
how can I use that to resize an MC?
-
you would do something like...
ratio=normalHeight/normalWidth
then go mc._width=stageWidth;
mc._height=mc.width*ratio
or something like that... maybe
that is asuming that the width is smaller than the height.
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
|