View Full Version : Flash Player resize?
dawood77
December 15th, 2009, 02:15 PM
Does anyone know how to set the flash player, not the contents to resize to fit browser window.
[SWF(width="1024", height="768", backgroundColor="#000000", frameRate="29")]
My main swf is set to the above, but I want it to resize and fit the window?
:) thanks for the time.
SparK_BR
December 15th, 2009, 05:13 PM
I need that info too
maybe some html? or javascript can do the job?
suggestions?
far100
December 15th, 2009, 05:28 PM
I am not sure I completely understood what you are asking for.
I think you are asking what radRacer in the newgrounds forums asked:
"When you resize your browser window the size of the flash document changes (you'll notice if you right click anywhere on the screen you get flash options meaning the flash document takes up 100% of the space). The size of the flash document resizes to match the browser window size but does not resize or distort the content inside of the flash swf.
Does anyone know how to go about doing this?"
If so, check out the options presented by KaynSlamdyke:
http://www.newgrounds.com/bbs/topic/991329
Scythe
December 15th, 2009, 08:08 PM
File > Publish Settings. HTML tab. Set Dimensions to Percent, and Width and Height to 100.
Include the following somewhere near the beginning of your code:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
theCodeBot
December 15th, 2009, 08:18 PM
Addition to Scythe's post:
Using the NoScale mode in combination with 100% sizing (and topLeft positioning in this case) will assure that your player will grow and shrink with the browser, but your content does not grow or shrink - only the available space in the player window does. Obviously, this throws off a LOT of positioning calculations if you are using them. As such, an Event.RESIZE is fired to the stage whenever this happens, so that you may update positions and so on. There are many threads that teach you how to manipulate this information.
Now, if you want to scale your SWF to fit the window and keep the same ratio, that does usually involve a little bit of javascript. You would set the SWF to 100% width and height, as Scythe described, and then on the javascript end, place that SWF in a div container. That container, through JS, will have it's height and width mathematically changed to fit the proper proportions and the window simultaneously. The math for this is also adequately documented on these forums, but I'll gladly show it to you if you'd like.
dawood77
December 15th, 2009, 09:29 PM
Thanks guys for taking the time.
http://www.pronghornclub.com/
this is the effect im looking for.
The background image on this site resized automatically.
I used the publish settings to be 100 and 100% then
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
But that seems to then resize everything in the player.
Scythe
December 15th, 2009, 10:27 PM
http://www.pronghornclub.com/
this is the effect im looking for.
You're looking for a slow, choppy effect that's full of bugs?
I see what you're saying, though. I've done stuff like that, where objects get repositioned differently and some parts of the site resize and some don't. Heck, I've even made stuff resize at different rates. theCodeBot has it down. Use resize events, and the new values for stage.stageWidth and stage.stageHeight.
I used the publish settings to be 100 and 100% then
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
But that seems to then resize everything in the player.
You sure about that? Nothing should resize at all if you've set the scaleMode to NO_SCALE. Either that code isn't executing or things are just appearing to get resized as part of some optical illusion.
dawood77
December 15th, 2009, 10:32 PM
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function resizeBG(evt:Event){
trace(stage.stageWidth+", "+stage.stageHeight);
}
stage.addEventListener(Event.RESIZE, createBackground);
function createBackground(evt:Event){
ball_mc.width =stage.stageWidth;
ball_mc.height =stage.stageHeight;
}
stage.addEventListener(Event.RESIZE, createBackground);
in this technique the image does resize but not proportionately. :(
dawood77
December 15th, 2009, 10:47 PM
http://blog.fryewiles.com/design/07-14-2008/proportional-image-scaling-in-full-browser-flash
found a link that has a method.
I know I know, rookies. ;)
dawood77
December 15th, 2009, 11:55 PM
@theCodeBot (http://www.kirupa.com/forum/member.php?u=121149): yes any help would be great! :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.