?
Solved

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

Posted on 2009-02-12
17
Medium Priority
?
990 Views
Last Modified: 2013-11-11
What can I do about it?
0
Comment
Question by:X20
  • 11
  • 4
16 Comments
 

Author Comment

by:X20
ID: 23622867
dynamically of course.
0
 
LVL 9

Expert Comment

by:pepsichris
ID: 23625502
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
 

Author Comment

by:X20
ID: 23627572
thank you very much, I'll try that as soon as possible and let you know!!

X20
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:X20
ID: 23627695
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
 

Author Comment

by:X20
ID: 23627749
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
 
LVL 9

Accepted Solution

by:
pepsichris earned 2000 total points
ID: 23628465
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
 

Author Comment

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

X20
0
 

Author Comment

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

Author Comment

by:X20
ID: 23630878
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
 

Author Comment

by:X20
ID: 23630884
Here is my test!

X20
test.rar.txt
0
 
LVL 9

Expert Comment

by:pepsichris
ID: 23632356
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
 

Author Comment

by:X20
ID: 23632503
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
 
LVL 9

Expert Comment

by:pepsichris
ID: 23640037
Thank you, WhackAMod.
0
 

Author Comment

by:X20
ID: 23640128
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
 

Author Comment

by:X20
ID: 23640137
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
 
LVL 8

Expert Comment

by:Dreammonkey
ID: 23640242
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question