Groups | Blog | Home
all groups > macromedia flash sitedesign > october 2007 >

macromedia flash sitedesign : Stretch a graphic/layer only horiztonally


egoldin
10/4/2007 9:43:13 AM
Hi all,
So here's my problem. I'm designing a site where a small beige box serves as
the background for the content of each page on the site. However, my problem is
that, while I'd like the rest of the content and images and shapes on the page
not to scale due to larger/smaller windows, I would like the single box to
stretch horizonally across the page, so it fills it from side to side. I do not
want it to scale vertically, however.

You can view my project here:
goldinroute.com/macgregor/master.html

Click on "About." Yes, I know the design is hideous. I'm trying to get this
figured out before I work any further on it (though I'm open to design
suggestions as well!). Does anyone know how I can do this?:sad;
aniebel
10/4/2007 10:24:08 AM
You'll need to utilize the "onResize" event of the Stage class. This allows you
to set an action that will happen any time the stage has been resized. In this
case you're going to change the width of the beige box each time the stage has
been resized.

Assuming that your beige box has been converted to a movie clip, and has an
instance name of "beige_mc" and is on the main timeline, you can use the
following code in your actions layer in frame 1 of your main timeline.



Stage.align = "TL";
Stage.scaleMode = "noScale";
sizeListener = new Object();
sizeListener.onResize =beige_mc._width = Stage.width;
egoldin
10/5/2007 12:00:00 AM
Amy,
Thanks SO much for your help! Your code has definitely put me on the right
track, but I could your (or anyone else's help) figuring out everything. Here
is the code I now have:

Stage.align = "TL";
Stage.scaleMode = "noScale";
stop ();
boxmovie._width = Stage.width + 100;
boxmovie._x = 0;

sizeListener = new Object();
sizeListener.onResize = function() {
boxmovie._width = Stage.width;
};

Stage.addListener(sizeListener);

Problem is, as you can see at (goldinroute.com/macgregor/about.html) that the
box has some strange margins around it. Initially there is a margin on the
left. Then, when you resize the window, a margin appears on the left. This
occurs in Flash preview as well as when I load the html file into a browser, so
I know it's just the browser inserting margins. Obviously, I'd like no margins
to appear at all. Any ideas?

Second, while I got essentially what I wanted to happen in the about..swf
file, the problem is that this resizing and the stage.width attributes don't
show up when this swf is loaded into my master swf. You can view that at
goldinroute.com/macgregor/master.html. This is the key. Any ideas? I imagine
it's because it's referring to the stage in about.swf, which doesn't take into
account how bout master.swf is. The code I use to load in about.swf is:

var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
myMCL.loadClip("splash.swf", 20);

Thanks!







Stage.align = "TL";
Stage.scaleMode = "noScale";
stop ();
boxmovie._width = Stage.width;
boxmovie._x = 0;

sizeListener = new Object();
sizeListener.onResize = function() {
boxmovie._width = Stage.width;
};

Stage.addListener(sizeListener);
AddThis Social Bookmark Button