We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

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

X20
X20 asked
on
Medium Priority
1,004 Views
Last Modified: 2013-11-11
What can I do about it?
Comment
Watch Question

X20

Author

Commented:
dynamically of course.
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

X20

Author

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

X20
X20

Author

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?
X20

Author

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
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
X20

Author

Commented:
ok thanks, I'm working on it! I'll get back to you as soon as possible.

X20
X20

Author

Commented:
does this work only with movie clips? I have dynamic scenes and containers to be resized for a photo gallery.
X20

Author

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
X20

Author

Commented:
Here is my test!

X20
test.rar.txt
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.
X20

Author

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.
Thank you, WhackAMod.
X20

Author

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.
X20

Author

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
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.