A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: A script that changes objects based on res.

  1. #1
    Hey, I was woundering if anyone knew of a script that would detect the users screen resolution and then change a HTML tag through SSI depending on the resolution? This would be really helpful so I don't have to make 2 different pages for different resoulutions! Thanks!

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    hm - i think there are more than 2 resolutions out there, resulting in creating more than 2 versions then. i suggest to stick with a resolution you think is best.
    I wouldn't care about people with super low resolutions (<= 800x600). In general it's bad to force any specific resolution for webdesign, because html was designed to enable dynamic display for many devices like Screens, Printers, PDAs and so forth. so consider creating an autofit version instead.

    my 0.02 €
    Yours
    HTD

  3. #3
    Senior Member
    Join Date
    Jun 2000
    Posts
    687
    Yeah here's an outline of one way to do this:

    The basic is this:

    If W and H do not have a value activate this code.

    print "<HTML><HEAD><SCRIPT LANGUAGE=\"javascript\">top.location=\"indexNew.ph p?W=\"+screen.width+\"&H=\"+screen.height;</script></HEAD><BODY></BODY></HTML>";

    Then after your forwarded onto the new Page - W and H will have a value. Grab that value (W=width, H=Height) from the URL string.

    Set a cookie with that Data - so you don't have to test again. Then run the rest of the script.

    Then use some code like this (this is what I'm using but havn't worked it out perfectly yet)
    if ($W > '1024') {
    $width = ($W*900) / 1024;
    $height = ($H*620) / 768;
    }
    else {
    $width = 900;
    $height = 620;
    }

    (these probably are not the best dimensions to use - but I was forced to so I had to use them).

    Ok so you have your Scaled width and Height attributes.

    Then use those dimensions to embed your SWF Movie.


    -Ok that was a brief explaination - Also this is all done with PHP and Javascript - and the two grabbing results from One another.

    Benifits: Looks good on all screen resolutions - Especially on those with really large screen resolutions like 1600x1200 when other fixed resolutions look tiny - And you don't have to worry about all your dynamic text being all crapped up with weird scaling and 100%x100% stuff.

    This took me a while - like a couple hours one night to figure out - but it does work well.

    Questions on that: http://www.flash-db.com/Board/

    [Edited by snowdude on 01-29-2002 at 04:41 AM]

  4. #4
    Um...actually that won't work snowdude cause I am doing an HTML site with this so the H&W values will be different for different objects...I will talk to a friend that works a lot with PHP and see what he can do with this! Thanks, anyway.

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Posts
    687
    It's the exact same concept though. Just embed the different scaled Height and width attributes for whatever you want once you have captured the user's screen res. This would be difficult, but not impossible, if you could only use javascript - just cause it's annoying to right everything like document.write(<table width=\"Scaledwidth\">) - etc etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center