Skip to main content
W_Bell
Inspiring
December 31, 2008
Answered

Change background color of Stage with AS

  • December 31, 2008
  • 3 replies
  • 2097 views
We I have a preloader that plays behind my transparent movie clip and I want to change the stage to black
when I go to Full Screen. From what I have found most people use a black box but that won't scale in FS.
So does anybody have another solution for changing the background color with AS that would help a lot.

W Bell.
This topic has been closed for replies.
Correct answer

To resize an mc box-background to the size of the stage, you can use the following script:

var lsnr = new Object();

lsnr.onResize = function () {

     _root.boxMc._width = Stage.width;

     _root.boxMc._height = Stage.height;

}

Stage.addListener(lsnr);

This assumes your background-box is named boxMc and resides on the root timeline, and that the movie is in noscale mode.

EDIT: Another option is to just make the mc-background huge, so it will always cover the entire screen.

3 replies

May 29, 2009

I have the same problem.. I'm designing a desktop application, that is goning to be published to an .EXE file, so I don't have the browser background properties' support when FullScreen Mode is displayed.. I have look all over the web and I haven't find a thing, it seems the only way to do this is using the Box MovieClip's trick, so i have a question for this: How do I resize dinamically the Box MovieClip so it can fit the whole screen in FullScreen Mode? Thanks..

Correct answer
May 30, 2009

To resize an mc box-background to the size of the stage, you can use the following script:

var lsnr = new Object();

lsnr.onResize = function () {

     _root.boxMc._width = Stage.width;

     _root.boxMc._height = Stage.height;

}

Stage.addListener(lsnr);

This assumes your background-box is named boxMc and resides on the root timeline, and that the movie is in noscale mode.

EDIT: Another option is to just make the mc-background huge, so it will always cover the entire screen.

W_Bell
W_BellAuthor
Inspiring
October 28, 2009

Well this was what I did but I did not use the listener.

I think your listener code is better than setting a condition.

This may come in handy in the future or if I can revisit this issue.

Thks SJ

clbeech
Inspiring
December 31, 2008
create a background MC box the size of the stage place on the lowest level, and adjust the color using the ColorTransform class as needed.
W_Bell
W_BellAuthor
Inspiring
January 1, 2009
As I metion in the original post, the Black Box will not scale in full screen.
Single_Ton also missed the point but had a solution and failed to post it.
He said to use Java but what script and where do you put it?

NOTE: When using FS the objects on Stage retain their scale unless you
changeProp on certain ones you want to display. You wold have to use
a stage size var to get the box scaled to any size monitor and the objects
are pixel dependant and will not scale to fit in FS.


This brings me back to my point in question. I want to use a transparent background
in the MC so the HTML doc won't solve the problem. The Background colour comes from
the Player so setting the HTML to Black will not do the trick.

Any other thoughts on this?
Ned Murphy
Legend
January 1, 2009
As far as I know, you cannot change the stage color using AS. While I don't know what's driving the stage color beyond being the black you want, one thing you might consider is somewhat the opposite of what was already suggested. Make the stage color black, and then use a movieclip background when you no longer want the black background to show. I might have missed the point as well, but then maybe you haven't really made the point clearly enough... in any case, an AS stage color change is not likely an option.
Inspiring
December 31, 2008
you need to Use JAVA SCRIPT to do that.

otherwise you have to scale the black box when full screen event captured