PDA

View Full Version : Dynamically Resize Flash While Keeping Ratio?


ratiocinator
04-15-2007, 01:37 AM
Hi all,

Sorry if this has been posted. I did a search but didn't find the exact solution I was looking for. This request for a dynamic resize/maintain ratio is slightly different than most solutions published so far. I'm not sure if this can/should be done in Flash/ActionScript or through external HTML.

I'm wanting a Flash file to fit 100% width-wise of a user's screen and the height will dynamically adjust to maintain the ratio. For example:

A user's screen resolution is 1280x1024
The Flash file's native size is 1150x250
When viewing the site, the Flash file expands to fit 100% of the user's screen width-wise (making the Flash file's width 1280 if the Internet browser if fully maximized for this example)
The Flash file then adjusts it's height to maintain the aspect ratio of it's width (which the width would be 1280 for this example, making it's height adjust to 278)

In a nutshell: The width of the Flash will be 100% (meaning it is never "set" and always ever-changing) and it's height will always adjust according to it's width to maintain the proper ratio.

Again, I have no idea if Flash/ActionScript would be the best call or doing it through HTML. I hope what I'm asking help for isn't too hard. I am completely new at Flash and am just starting to dabble in it.

Oh, and if it makes a difference: I will be putting this Flash file inside a DIV with it's position being absolute. I believe if I set the DIV's width to 100% and leave the height blank, it should automatically resize based on the Flash file.

Anyway, I would GREATLY appreciate any help on this matter as it's preventing me from moving forward on my site.

Thanks for any help!

icktoofay
04-15-2007, 06:47 AM
Javascript could probably resize it to the correct size onload. And for that matter, if you're publishing to Flash Player 8, you can actually use flash.external.ExternalInterface to execute the Javascript, so it's not embedded in the HTML.

ratiocinator
04-15-2007, 05:22 PM
Thanks for the head start. After countless hours of searching, I haven't found any Flash, JavaScript or HTML scripts to get this request to work.

Would you by any chance have the script for this?

ratiocinator
04-21-2007, 05:21 PM
Update: Still have been doing research and still haven't been able to find anything. Would anyone here with good knowledge on Flash help me out?

Thanks