This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > June 2005 > Auto scale Flash movie to match screen dimension





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Auto scale Flash movie to match screen dimension
huunghi

2005-06-22, 4:20 am

Dears,

My English is terrible, so I just want you all to visit this
http://explorer.monticello.org/ first, so that you can understand what I am
talking about.

Did you see the Flash movie, it automatically scales to match the screen? I
don't know how they can do that (maybe get javascript variant and use for
ActionScript).

I would appreciate if you all can help me with this, because I would like to
use it for my new project.

Many thanks,

merlinvicki

2005-06-22, 7:19 pm

Keep WIDTH="100%" HEIGHT="100%" for the embedded flash in your HTML file.
Thats it!

Please search the forums before asking these basic questions. These have answered numerous times.
huunghi

2005-06-22, 7:19 pm

Dear merlinvicki,

Thanks for your reply but please understand my question clearly before giving
such answer.

Giving width and height 100% may scale the Flash to fit window, but the answer
I'd like to find out is, how can they keep the footer always at the bottom of
page. Of course we can not use normal symbols, so, in this case how
ActionScript be used here is the matter. May I get or see the copy of that? Or
just tell me the direction to do it?

And, I don't know whether it is a basic question or not, but not everyone is
experienced like you. To me, it's not basic, so, once again, please understand.

merlinvicki

2005-06-22, 7:19 pm

Ok. Point taken.
*you can use the same script in for your flash just by replacing the filename.
However lets go through the javascript at http://www.webshocker.net so you
can understand what they are doing.

In the javascript you will see they are checking for the client browser
dimensions via
window.innerWidth; and then assigning its value to the variable myWidth and
myHeight
myWidth = window.innerWidth;
myHeight = window.innerHeight;

After assigning the browser dimensions in the the variable they are using
these values to define the height and width parameters of the shockwave in the
Object tags( where we usually define them hard-coded):

document.write('<OBJECT id="flashMovie" data="root.swf?myWidth='+ myWidth
+'&myHeight='+ myHeight +'" type="application/x-shockwave-flash" WIDTH="100%"
HEIGHT="100%">');

Here allt he code between the document.write function is plain HTML but we are
using the javascript to access the values earlier defined for myWidth and
myHeight. This way they are changing the height/width values for the shockwave
at runtime.

They have also kept a check for browser dimension less than 800*580. So that
if the browser is resized less than these values it would still maintain the
height and width values at 800*580, not less.
if (myWidth<800){
myWidth=800;
}
if (myHeight<580){
myHeight=580;
}

I would still recommend Not using this since a lot of people switch off
javascript. For them ur page will not be able to show any content. Try just
keeping height at 100%. Should do the trick. or you should have a redirection
page for non-javascript support.
:)


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews