• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 993
  • Last Modified:

How can I detect the user's screen resoultion in AS3 to make my stage and its contents the same size?

What can I do about it?
0
X20
Asked:
X20
  • 11
  • 4
1 Solution
 
X20Author Commented:
dynamically of course.
0
 
pepsichrisCommented:
I think you're thinking about it the wrong way.

You'll use HTML to make sure it's always 100% of the window, and so you can act as if that has literally changed your stage size.

Set the scale mode to NO_SCALE (see http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Stage.html#scaleMode)

And then you'll use the onResize event to layout your content, so if you wanted your clip myMenu to always be right aligned, you'd have:

 
addEventListener(Event.RESIZE, onResize);
 
private function onResize(evt : Event) : void {
    myMenu.x = stage.stageWidth - myMenu.width;
}

Open in new window

0
 
X20Author Commented:
thank you very much, I'll try that as soon as possible and let you know!!

X20
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
X20Author Commented:
Does this actually change the size of the stage?

My actual stage size is 1280x800. If the user resolution is 1920x1080, will the stage resize like that?
0
 
X20Author Commented:
or do I have to write that code for every componenet on my stage? Can you write a simple working example please? That would just definitely make things easier and quicker.

Thank you!

X20
0
 
pepsichrisCommented:
The browser window is not the same as the resolution

If the user's resolution is 1920 x 1080, then then the browser window, and therefore the Flash, might be about 1800 x 800, but it varies from user to user, as they might have different toolbars etc.

Here's an example - it shows some basic interaction.

http://acleveraddress.com/exex/resize.fla
0
 
X20Author Commented:
ok thanks, I'm working on it! I'll get back to you as soon as possible.

X20
0
 
X20Author Commented:
does this work only with movie clips? I have dynamic scenes and containers to be resized for a photo gallery.
0
 
X20Author Commented:
Ok I'm pretty tired on trying things on about this stuff, I'm sure you can make much more esaily and quiker than me. I send you the code for my gallery with some test pictures. I just want the gallery to appear in all the user's screen with all the stuff in it. Can you work this out so that everything that is inside it can be displayed properly as you said?

Thanks!!
X20
0
 
X20Author Commented:
Here is my test!

X20
test.rar.txt
0
 
pepsichrisCommented:
Ha!

No, I won't be doing it all for you. I've shown you how it all works, so you should get an understanding of it and develop it yourself.

It's all very straight forward once you get the concept, so maybe create a sample FLA, or use the one I gave you, and learn properly how it works.

I'm not here just to do your work for you when you get a little tired or bored with it! Anybody who has learnt Actionscript properly has done it by putting the hard work in - there's no reason it was any easier for us to learn it then you.
0
 
X20Author Commented:
This is not because I'm lazy! I simply thought that you would be doing it in snap. But anyway, thank you for your help.
0
 
pepsichrisCommented:
Thank you, WhackAMod.
0
 
X20Author Commented:
And please bear in mind that in no way I have ever obliged anyone to do anything. Besides, that solution is GRADE B for my case (what is this thing of reassigning grades???) because my problem isn't solved yet and I'm still working on it cause it's very different from what the expert told me, which is just a general case.

Thank you.
0
 
X20Author Commented:
That thing applies to movie clips, and I have no movie clips on my stage, and I still don't kow what to do about it.

Bye bye
0
 
DreammonkeyCommented:
Is this website still called Experts Exchange or has someone changed the name to Kindergarten Quarrel ?
Maybe we need to shift zone's on this one?

DM
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 11
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now