PDA

View Full Version : Detecting screen width



JustinM
October 13th, 2003, 08:40 AM
The problem that I'm facing is in regards to the width of a sliding menu that I've created. The menu slides based on mouse x position and width of the movie. I would like the menu to fit to the entire screen regardless of the users resolution. I wanted to know if there's a way to detect a users screen width and then adjust the variable for screen width within my actionscript. I can provide the .fla if necessary. Thanks!

kode
October 13th, 2003, 09:57 AM
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary716.html

JustinM
October 13th, 2003, 10:19 AM
Thanks for the reply. Once I grab that value, can it be assigned to my variable that determines the menu width?

kode
October 13th, 2003, 10:27 AM
Yes? :P

var variableThatDeterminesTheMenuWidth = System.capabilities.screenResolutionX

JustinM
October 13th, 2003, 11:44 AM
My variable does change to the detected screen width. The problem that I'm having now is changing the entire movie size to also accomodate. I've tried changing the stage.width property, I've also tried changing my publish settings to 100% width and still the movie doesn't resize to the browser. Any help is appreciated.

kode
October 13th, 2003, 11:47 AM
The width property of the Stage object is read-only!
Publish the movie at 100% width and height and set the scaleMode property to "noScale". ;)

Stage.scaleMode = "noScale";
That should do, I think. :)

JustinM
October 13th, 2003, 12:00 PM
That didn't have any affect on the resizing of the project. Maybe I'm leaving out some details. Currently the stage is set to 1000px, so it looks good when viewed at 1024. What I'm trying to do is change that stage width property when viewed at 800 x 600. The height of the movie should be about 30% of either screen resolution. Neither width or height is resizing as specified in publish settings. I'm using Flash MX if that makes any difference.

kode
October 13th, 2003, 12:07 PM
Oh! You want to resize the whole thing. :P
I thought you only wanted to resize the menu, and keep everything else at its original size.

In that case, removing the Stage.scaleMode = "noScale"; thing, and publishing at 100% should work. :-\


Attach your FLA. ;)

JustinM
October 14th, 2003, 10:04 AM
Ok, I tried removing that code snippet and I still didn't have any luck. The stage width is currently set to 1000 which allows the menu to be viewed correctly at 1024 res. I've tried setting it to 800 which works for 800x600 res but still comes up short for 1024 res. I'm testing by dropping the published .swf in a web page. I can't attach the .fla because it's too big, like 400k. My email address is Justin@trimerous.com. If you would send me your email address or post it, I can email you the .fla. Thanks so much for your help!

kode
October 14th, 2003, 12:31 PM
Check your PMs. ;)

kode
October 15th, 2003, 02:43 PM
Ehmm... I just wanted to let you know that I'm still waiting for the file(s). :P

Hope you figured it out on your own. :)