all groups > flash actionscript > november 2005 >
You're in the

flash actionscript

group:

Scaling Background MovieClip, But Not The Other/Specific Movie Clips???


Scaling Background MovieClip, But Not The Other/Specific Movie Clips??? complexity
11/9/2005 11:23:26 PM
flash actionscript:
Hi all,

I am setting my flash movie to take up 100% browser width. And I would like to
be able to have my background scales to the full width, but leave the rest of
the movie clips in my movie unscaled.

On another thread someone said to look at this tutorial:
http://www.kirupa.com/developer/mx2004/fullscreen.htm
But it doesnt actually tell you how to scale the background.

Presently I am scaling my movie by setting the dimension of the movie by
100%x100% and then in actionscript:
Stage.align = "T";
Stage.scaleMode = "noScale";

I thought I might be able to go mcname.scaleMode = "noScale";

But it did not work.

Any help would be great.
Re: Scaling Background MovieClip, But Not The Other/Specific Movie Clips??? JayCharles
11/9/2005 11:56:30 PM
You're halfway there.

What you need to do is create a function that resizes the backround each time
the size of the stage is changed.

Let's assume your backround movieclip is named "bg_mc". your function might
look like this:

var stageContent = new Object();
stageContent .onResize = function(){
doBGResize();
}

function doBGResize(){
bg_mc._width = Stage.width;
bg_mc._height = Stage.height;
}

Stage.scaleMode = "noScale";
Stage.align = "tl";
Stage.addListener(stageConent);

// Now call it once so the backgound resizes when this AS loads
doBGResize();


That should do it for you.


Re: Scaling Background MovieClip, But Not The Other/Specific Movie Clips??? complexity
11/10/2005 12:00:00 AM
Ok answered my own question, you have to wait quite a few frames before
instagating the onResize() listener.
Firefox didnt seem to mind, but IE need this waiting for it to detect and
place everything in the correct positions.


Re: Scaling Background MovieClip, But Not The Other/Specific Movie Clips??? complexity
11/10/2005 12:16:21 AM
Hi Jay thanks for the help, slight issue.
For some reason my background only scales about 105% and now sits to the top
right of the stage.
I need my non scaled content to be centered so I have:

var stageContent = new Object();
stageContent .onResize = function(){
doBGResize();
}

function doBGResize(){
bg_mc._width = Stage.width;
bg_mc._height = Stage.height;
}

Stage.scaleMode = "noScale";
Stage.align = "T";
Stage.addListener(stageConent);

// Now call it once so the backgound resizes when this AS loads
doBGResize();


Also the background is set to the right in Firefox but in IE I have no
background? Im using the publish straight out of flash no additional html etc.

Re: Scaling Background MovieClip, But Not The Other/Specific Movie Clips??? complexity
11/10/2005 12:22:02 AM
Ok Jay when I set it back to

Stage.align = "TL";

AddThis Social Bookmark Button