8 Replies Latest reply on May 18, 2006 4:45 AM by Rothrock

    loadMovieNum() - background color

    Level 7
      Flash-8 Help says about loadMovieNum():
      "you can load SWF files into a level that already has a SWF file loaded into
      it. If you do, the new SWF file will replace the existing SWF file. If you
      load a SWF file into level 0, every level in Flash Player is unloaded, and
      level 0 is replaced with the new file. The SWF file in level 0 sets the
      frame rate, background color, and frame size for all other loaded SWF
      files".

      In my case after loadMovieNum(new_SWF,0) background color of the
      original_SWF persists.
      My original file has no instruction to be loaded into Level 0 - I guess it
      get loaded into Level o by default.
      How do I force the background color of the new_SWF to take over?


        • 1. Re: loadMovieNum() - background color
          Level 7
          aa wrote:

          > Flash-8 Help says about loadMovieNum():
          > "you can load SWF files into a level that already has a SWF file loaded
          > into it. If you do, the new SWF file will replace the existing SWF file.
          > If you load a SWF file into level 0, every level in Flash Player is
          > unloaded, and level 0 is replaced with the new file. The SWF file in level
          > 0 sets the frame rate, background color, and frame size for all other
          > loaded SWF files".

          This documentation is misleading. If I recall correctly, it should read
          something like: "[...] The first SWF file loaded in level 0 (the one that
          the Flash player initializes with) sets the frame rate, background color,
          and frame size for all other SWF files loaded subsequently."

          That mans, that if you load a new movie in _level0 to replace the original,
          the background color and frate rate of the new movie will be adjusted to
          match the original.


          > In my case after loadMovieNum(new_SWF,0) background color of the
          > original_SWF persists.
          > My original file has no instruction to be loaded into Level 0 - I guess it
          > get loaded into Level o by default.

          That's correct, the first swf that the flash player loads goes by default
          into _level0.


          > How do I force the background color of the new_SWF to take over?

          You cannot. A Simple workaround is to draw manually a rectangle background
          that is of the color that you want and that covers the stage.

          hth,
          Tim

          • 3. Re: loadMovieNum() - background color
            Level 7

            "aa" <A@aa.com> wrote in message news:e4euoo$klm$1@forums.macromedia.com...
            > Flash-8 Help says about loadMovieNum():
            > "you can load SWF files into a level that already has a SWF file loaded into
            > it. If you do, the new SWF file will replace the existing SWF file. If you
            > load a SWF file into level 0, every level in Flash Player is unloaded, and
            > level 0 is replaced with the new file. The SWF file in level 0 sets the
            > frame rate, background color, and frame size for all other loaded SWF
            > files".
            >
            > In my case after loadMovieNum(new_SWF,0) background color of the
            > original_SWF persists.
            > My original file has no instruction to be loaded into Level 0 - I guess it
            > get loaded into Level o by default.
            > How do I force the background color of the new_SWF to take over?
            >

            Here is a way to draw a background dynamically that works really well..
            http://www.brajeshwar.com/archives/2003/02/dynamic-background-color/

            You can also change the Web page's background color to match using a javascript call from Flash. (I would need to find it)
            tralfaz


            • 4. Re: loadMovieNum() - background color
              Rothrock Level 5
              Additionally, I don't think it is a good idea to load external files into _level0.

              Over the years I've occasionally seen subtle problems arise from this practice. Things that only happen on one platform or the other, or only in a projector, etc. So there is a (slight) downside and absolutely no upside that I can see. You have thousands of levels to work with so don't be stingy.
              • 5. Re: loadMovieNum() - background color
                Level 7
                I run SWF in Player directly with no browser.
                I have a game catalogue implemented as swf.
                So I start catalogue swf and then by clicking relevant icons run different
                games in that same player window.
                So it is important that every newly loaded swf runs afresh with no legacy
                from the previous swf.
                From what I read Level 0 is supposed to be used for this purpose. Is this
                wrong?

                "Rothrock" <webforumsuser@macromedia.com> wrote in message
                news:e4foi0$osn$1@forums.macromedia.com...
                > Additionally, I don't think it is a good idea to load external files into
                > _level0.
                >
                > Over the years I've occasionally seen subtle problems arise from this
                > practice. Things that only happen on one platform or the other, or only in
                a
                > projector, etc. So there is a (slight) downside and absolutely no upside
                that I
                > can see. You have thousands of levels to work with so don't be stingy.
                >


                • 6. Re: loadMovieNum() - background color
                  Rothrock Level 5
                  Well IMHO that is not such good design, but if it works for you go ahead.

                  First, for any kind of distributed files, there will be a problem with playing a swf directly in the player. The player only comes with the authoring environment. Others will need to play in a browser or use a stand-alone projector.

                  As for the loading part. I wouldn't count on loading into _level0 as a way to make sure that each newly loaded swf runs afresh with no legacy from the previous swf. That should be part of having well coded swfs to begin with. They shouldn't leave "crap" behind.

                  In any event, if I was implementing this, I would make my catalogue selection screen to be the default projector file. I would then have it load content into _level1 or some other number, probably with some menu or button from _level0 still showing to allow quitting/returning to the catalogue selection screen. When pressed that button would unload the game in _level1 and return the user to _level0.

                  Of course the good housecleaning habits of making sure a swf doesn't leave stuff behind might be more work than the benefit. And if you haven't had problems reloading stuff into _level0 then I don't think it is really something to worry about. But do be aware of the potential for trouble.

                  Then again I'm a cranky old man. I also don't advocate ever using _root in final code either so keep that in mind.
                  • 7. Re: loadMovieNum() - background color
                    Level 7
                    Thanks, Rothrock

                    1. "Well IMHO that is not such good design"
                    What would be a good design for what I am doing?

                    2. "The player only comes with the authoring environment".
                    Flash player is available for free on Macromedia site, it is not?

                    3. What is "projector"?

                    4. "That should be part of having well coded swfs"
                    What is "coded swfs" in terms of leaving legacy?


                    "Rothrock" <webforumsuser@macromedia.com> wrote in message
                    news:e4g8k9$***$1@forums.macromedia.com...
                    > Well IMHO that is not such good design, but if it works for you go ahead.
                    >
                    > First, for any kind of distributed files, there will be a problem with
                    playing
                    > a swf directly in the player. The player only comes with the authoring
                    > environment. Others will need to play in a browser or use a stand-alone
                    > projector.
                    >
                    > As for the loading part. I wouldn't count on loading into _level0 as a
                    way to
                    > make sure that each newly loaded swf runs afresh with no legacy from the
                    > previous swf. That should be part of having well coded swfs to begin with.
                    They
                    > shouldn't leave "crap" behind.
                    >
                    > In any event, if I was implementing this, I would make my catalogue
                    selection
                    > screen to be the default projector file. I would then have it load content
                    into
                    > _level1 or some other number, probably with some menu or button from
                    _level0
                    > still showing to allow quitting/returning to the catalogue selection
                    screen.
                    > When pressed that button would unload the game in _level1 and return the
                    user
                    > to _level0.
                    >
                    > Of course the good housecleaning habits of making sure a swf doesn't
                    leave
                    > stuff behind might be more work than the benefit. And if you haven't had
                    > problems reloading stuff into _level0 then I don't think it is really
                    something
                    > to worry about. But do be aware of the potential for trouble.
                    >
                    > Then again I'm a cranky old man. I also don't advocate ever using _root
                    in
                    > final code either so keep that in mind.
                    >


                    • 8. Re: loadMovieNum() - background color
                      Rothrock Level 5
                      1. I think what I listed above would be better design. Menu/selector in _level0 and loading/unloading external assets into _level1.

                      2. No the player is only for the authoring environment. The plugin is free for download but it only allows people to play flash in a browser. If you just give a regular user a swf file they won't be able to do anything with it without a browser. (Or possibly in some cases with a third party player, but they aren't common.)

                      3. A projector is a way to publish your file and bundle the player together with it making a stand alone "app". This means the end user doesn't even have to have the plug-in installed or that you need to worry about having the correct version. It is all together. The down side is that it makes the file at least about 1.2 megs and it also doesn't bundle in any externally called files – they must be included with any distribution.

                      4. When you mentioned reloading into _level0 so as that it "runs afresh with no legacy." I think it is a better strategy so that when you unload the file it is gone and leaves no code, eventhandlers, variables, intervals etc. So in other words, the actionscript in that file is tight, well designed, and not sloppy.

                      But if this system is just for you and it works well the do it however you like. But if you are going to distribute it these are some of the things you should think about.