This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > April 2004 > How to get flash to dynamically resize itself as IE window expands/contracts





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to get flash to dynamically resize itself as IE window expands/contracts
Matt

2004-04-21, 3:15 pm

I've seen some flash sites that size themselves in relation to the size of
the IE window. As the IE window size alters, the flash dymanically resizes
itself so that its always visible. Can someone tell me how this is achieved
and where can I get the code from to do this?

Thanks.
Matt.


BT News

2004-04-30, 5:33 pm

Matt

You need to do a few things in order for this to work:

- Set the size of your movie to completely fill the browser window (or part
of the browser window, if that's what you want)
- Set your movie to align to the top left
- Set your movie to "no scale"
- Write some code to "listen" for Stage resizes

This is how you do each one:
- Set width="100%" height="100%" in the embed / object tag attributes
- Set the "SALGIN" attribute in the embed / object tags to "LT", OR insert
Stage.align = "LT"; in the first frame of your movie
- Set the "SCALE" attribute in the embed / object tags to "noscale", OR
insert Stage.scaleMode = "noscale"; in the first frame of your movie
- Insert the following code in the first frame of your Flash movie:

// Create an object to listen for the Stage.onResize event callback
this.$stageListener = {};
this.$stageListener.onResize = function()
{
this.$layoutGUI();
} // onResize

// Register our object as a listener
Stage.addListener(this.$stageListener);


// Function to layout the elements of the movie (called when the
// stage is resized)
this.$layoutGUI = function()
{
// Code goes in here to layout your GUI elements
} // $layoutGUI


I think that's about it. Flash has a habit of missing the inital window
resize, especially if the movie is still initialising, so you may want to
call your layout function directly when the movie first loads.

Regards
Stephen


"Matt" <mystery@BarrysworldNoLongerWorks.com> wrote in message
news:W2Ufc.417$CS4.176@newsfe1-win...
> I've seen some flash sites that size themselves in relation to the size of
> the IE window. As the IE window size alters, the flash dymanically

resizes
> itself so that its always visible. Can someone tell me how this is

achieved
> and where can I get the code from to do this?
>
> Thanks.
> Matt.
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews