10 Replies Latest reply on Oct 28, 2009 12:29 AM by W_Bell

    Change background color of Stage with AS

    W_Bell Level 1
      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.
        • 1. Re: Change background color of Stage with AS
          Single_Ton
          you need to Use JAVA SCRIPT to do that.

          otherwise you have to scale the black box when full screen event captured
          • 2. Re: Change background color of Stage with AS
            clbeech Level 3
            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.
            • 3. Re: Change background color of Stage with AS
              W_Bell Level 1
              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?
              • 4. Re: Change background color of Stage with AS
                Ned Murphy Adobe Community Professional & MVP
                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.
                • 5. Re: Change background color of Stage with AS
                  W_Bell Level 1
                  Well thanks for the stab at it.
                  If you change the stage to black the surrounding area in html is black.
                  My background is off-white so that won't work.

                  Even if you change the html to black you can't cover it with a Flash object.
                  I would need the mc player transparent to see the preloader.
                  The preloader is made of black text on the off-white backgrqound stage.
                  When I set the MC palyer to transparentm it loses the black of the mc Player.
                  That is how I get a black background in full screen.

                  There appears tobe no way to do this from what I see now.
                  Thank you all for the input!

                  W Bell
                  • 6. Re: Change background color of Stage with AS
                    clbeech Level 3
                    it sounds as though you are using scaleMode = 'noScale' - so that your assets are not scaled. you should be able to use the onResize event, to get the FS width and height properties of the stage and then either scale the bg mc, or use the drawing API to draw in your bg to a clip on that level, either constructed dynamically or placed in the IDE. although i do not know of any other code structures in your file, something like this:

                    • 7. Change background color of Stage with AS
                      W_Bell Level 1
                      Well this sounds like it may be a solution if I can get bg to work.
                      I tried putting the fill color in with no luck, possibly there is a conflict
                      with where I put the Listener.

                      Attached is my code for myPlayer5:
                      • 8. Re: Change background color of Stage with AS
                        Javier_Venezuela

                        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..

                        • 9. Re: Change background color of Stage with AS
                          SuperJAG Level 1

                          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.

                          • 10. Re: Change background color of Stage with AS
                            W_Bell Level 1

                            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