3 Replies Latest reply: May 22, 2007 12:37 PM by sam_london RSS

    Is it possible to load an external swf at a specific frame?

    mcommini Community Member
      Hey! I've got a flash file which acts as the main menu for a program I'm developing. Everything works fine from the main menu however when you click to return to the main menu the whole main menu file reloads. Is it possible to use loadMovieNum( ) to go to a specific frame within the main swf file? If not, is there a way to do this?

      Here's the button code I'm using now:
      on (release) {
      unloadMovieNum(0); //unloads the current movie so we can reload the main menu
      loadMovieNum("DemoMainMenu.swf", 0); //reloads the main menu
      }

      Thank you for whatever help you can provide! :)

        • 1. Re: Is it possible to load an external swf at a specific   frame?
          Newsgroup_User Community Member


          mcommini wrote:
          > Hey! I've got a flash file which acts as the main menu for a program I'm
          > developing. Everything works fine from the main menu however when you click to
          > return to the main menu the whole main menu file reloads. Is it possible to
          > use loadMovieNum( ) to go to a specific frame within the main swf file? If
          > not, is there a way to do this?

          First let me clarify one thing with you. Level zero is the main level on the flash
          player. By loading things in level zero you will remove current content and replace
          it with the new one. This is not a good idea because it works like purge, clears the
          player and from there on you can't maintain any functionality unless you reload the
          whole html document over again. Also, do not unload and load in the same time in the
          same level. Flash can hold single SWF per level, once you load content, whatever previously
          loaded will be automatically replaced, so just the loadMovie action and you all set.
          Good practice is to have the main level (zero) an empty base and than load and unload
          things in above levels, 1 and so on...

          > Here's the button code I'm using now:
          > on (release) {
          > unloadMovieNum(0); //unloads the current movie so we can reload the main menu
          > loadMovieNum("DemoMainMenu.swf", 0); //reloads the main menu
          > }
          >

          In regard to the load and go to. Yes it is possible but no matter what frame you want to
          go to,you need to load the whole movie first. I will come back to that in a second.

          While you execute the loadMovie action, you can set up a variable, for example:

          loadMovieNum("file.swf", 1);
          Variable="mcommini_01";

          Than in the loaded movie you have preloader which makes sure that the movie is loaded before
          playing and once done loading, make it jump to frame which has IF ELSE condition in some kind
          of loop, using setInterval or Enterframe. That condition checks for the variable value and based
          on it proceed to particular frame.
          That's why I told you not to clear level zero, if you set variable and load movie in that level
          in the same time, all the information will be gone and you have totally no reference point to
          get the variable from.
          You could as well use shared object which is native form of Flash's cookies. Write SOL file into
          user drive temp folder, than read it from the other file and go to frame based on the given value.




          --
          Best Regards

          Urami


          --

          Beauty is in the eye of the beer holder...


          <urami>
          If you want to mail me - DO NOT LAUGH AT MY ADDRESS
          </urami>
          • 2. Re: Is it possible to load an external swf at a specific frame?
            mcommini Community Member
            Urami,

            thank you for the info. My code must be wrong 'cause I tried what you suggested and it slowed the movie load time waaaaaaaay down then didn't appear when it was 'done' loading. I was pressed to get the demo in the mail so I'll work on it again soon and let you know what happens.

            Thank you,
            • 3. Re: Is it possible to load an external swf at a specific   frame?
              sam_london
              i dont quite understand that bit on how you make it go to a certain frame in the file you are loading

              do you think you could make it a bit simpler and give me bits of code that i need?

              thank you