3 Replies Latest reply on Jun 16, 2009 12:49 AM by Sivakanesh

    help with loadmovie!!!!

    bret001

      hi there, I have a website, in which case i have a main flash file, in the flash file, i have a scrollbar with different links to other swf files (submenus), in a loadmovie format, linking through url. now here is my issue:

       

      when i have submenus loaded through loadmovie, i have them on level 1, so as to not replace anything or have any issues.

      if i wanted to make a previous or next button within these submenus, what would you have to put as coding so it actually loads?

       

      currently i have it just normally set as:

       

      on (release) {

      loadMovieNum("http://www.URL.com/folder/flashfile001.swf", 1);

      }

       

      except within the submenu, it doesnt work. (possibly because it already is a loaded movie on level one?)

      if theres a way to make a button in the main flash menu that recognizes the current file and knows how to go to the following or previous flash file, i could do that too, I'm just looking for the easiest way, since I'm not that great with actionscript. any help is appreciated!

       

      also, please try and keep the wording easy for me to understand, im not great with programming language!

      thanks!

        • 1. Re: help with loadmovie!!!!
          Sivakanesh

          So you have a main movie that contains a menu and acts as a container for other movies you load via the menu?

          If you want to add a previous and next buttons to your main movie obviously these buttons need to know the URL to the previous and next SWFs.  So the first thing to do is to make a list of all the external swfs.

          Best way to do this would be to put this in an XML file and load it when the main movie starts. But for now an array would do, something like;

           

          var ChildMovies:Array;
          ChildMovies[0] = "A.swf"
          ChildMovies[1] = "B.swf"
          ChildMovies[2] = "C.swf"
          

           

           

           

          You can now use the array index (0,1,2) to load the child movies using the menu;

          I'm not sure how you are creating and assigning the submenus, but assuming they are all manually created you can change the onrelease as below;

           

           

           

           

          on (release) {
          loadMovieNum(ChildMovies[1], 1);
          _root.CurrentMovie = 1;
          }
          

           

           

           

           

          Now you have variable that keeps track of which movie you have currently loaded. So when the prev button is pressed you can say;

           

           

           

          on (release) {
          loadMovieNum(ChildMovies[_root.CurrentMovie - 1], 1);
          _root.CurrentMovie = _root.CurrentMovie - 1;
          }
          

           

           

           

           

          And for the next button;

           

           

           

          on (release) {
          loadMovieNum(ChildMovies[_root.CurrentMovie + 1], 1);
          _root.CurrentMovie = _root.CurrentMovie + 1;
          }
          

           

           

           

           

          You will next to add some checks to see if you are already at the beginning or at the end, but this is the basic idea.  I would strongly recommend you use XML and dynamically create the submenus for maintainability and scalability once you have this working.

           

           

           

          Regards

          Siva

          • 2. Re: help with loadmovie!!!!
            bret001 Level 1

            thanks for the in depth instructions, but im not familiar with xml really, is there a way i could do this entirely through flash?

            to further explain what i have going on, and what im trying to achieve, its something like this:

             

            my first flash movie is embedded in a html file, the flash movie would be in a location such as www.url.com/page.swf

            in the embedded flash file, i have it link to alternate flash files, to embed within itself, using loadmovie.

             

            currently i have them all numbered, and listed in a flash scrollbar, with links like this:

             

            on (release) {

            loadMovieNum("http://www.url.com/folder/flashfile001.swf", 1);

            }

            on (release) {

            loadMovieNum("http://www.url.com/folder/flashfile002.swf", 1);

            }

            etc.

             

            what i then tried to do was make buttons within each loaded flash file, and have them coded so that you could load the previous or next movie in order.

            supposing the current movie loaded was flashfile004.swf, the code for the previous button would be:

            on (release) {

            loadMovieNum("http://www.url.com/folder/flashfile003.swf", 1);

            }

            and the coding for the next button would be:

            on (release) {

            loadMovieNum("http://www.url.com/folder/flashfile005.swf", 1);

            }

             

            only that doesnt work...

            • 3. Re: help with loadmovie!!!!
              Sivakanesh Level 1

              How you have it at the moment is not too dissimilar to how I suggested. You can leave it as it is.

              I have tried the structure you have described and it works fine. I'm not able see the problem without looking at your fla, are you able to post that with couple of external fla?

              But here is another thing you can try.

              Try and run the Main.swf from the attached zip.  If this works for you then there may be some issue with your structure.

               

              Regards

              Siva