We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

How is this resizing browser trick for flash done?

funhyun1
funhyun1 asked
on
Medium Priority
180 Views
Last Modified: 2008-03-10
Hi experts! Please take a look at http://www.triworks.net/triworks2007_eng/default.htm . You will notice that all the graphics are in its place and the background graphic resizes when you resize your browser to any size. Can someone explain how this is done or provide a sample script if there are any? Thanks!!
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2006

Commented:
Hi,

You can add a listener to the stage like so:

var myScreenManager = new Object();
myScreenManager.onResize = function() {
  trace("The screen resolution is currently " + Stage.width + " x " + Stage.height);
}

Then have:

Stage.addListener(myScreenManager).

You then also have to set the scaling mode to noscale to not have the clips on your stage scale when the swf resizes.

-r-

Author

Commented:
Roonan,
Wow, you just won the prize for the quickest reply!!! Just for that I should just give you the points!! ;)
So I can I can really learn this technique better, do you have or know a resource of a fla file that I can tinker with? I am just not sure where to place these codes. Thanks!
CERTIFIED EXPERT
Top Expert 2006

Commented:
You can read this tiny article on moock's blog: http://moock.org/asdg/technotes/relayout/
It has some example code also.

-r-
CERTIFIED EXPERT
Top Expert 2006
Commented:
In general the idea is to call this code as soon as possible, like in the actions for the first frame of your movie.

For testing from the Flash environment you would have to add first two lines also:

Stage.align = "T"
Stage.scaleMode = "noscale"

var myScreenManager = new Object();
myScreenManager.onResize = function() {
  trace("The screen resolution is currently " + Stage.width + " x " + Stage.height);
}

Stage.addListener(myScreenManager);

-r-

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

Ask the Experts

Author

Commented:
Fantastic. Thanks Roonan. :)
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.