16 Replies Latest reply on Jun 20, 2006 6:56 PM by kglad

    script to load out of external swf

    dizzy_nuts
      hi there, can anyone help

      I'm loading in and out external swf's into levels on a button action with

      on (release) {
      loadMovieNum("nameofmovie.swf", 2 )
      }

      what I'm trying to do is:
      once one movie(movie1.swf) has loaded into level 2, I want to load(on a different button press) another movie into the same level, but some how when the movie2 button is pressed, make the outro anim in movie1.swf playout so it give a smooth transition. Does any one know the script for this?? going slightly mad : (

      example of what I'm trying to do: http://www.thecreativepulse.com/home05.htm
      click on some of the drop down links and you will how they work! its like there is a scipt on each button telling it to play out the timeline anim in the movie already loaded before loading in new movie selection??

      I used a script to fade in and out movie clips in the same movie, does it work similar to this, but some how use external names??;

      on (release) {
      tellTarget ("/text7") {
      if (Number(_currentframe) == 21) {
      play();
      }
      }

      tellTarget ("/player1") {
      play();
      }
      }


      please can anyone help
      kind regards
      p
        • 1. Re: script to load out of external swf
          kglad Adobe Community Professional & MVP
          you must either initiate a loop that checks when the outro completes and then loads the next external swf or place a loadMovieNum() statement in you external swfs that executes when the outro completes. in both cases, you'll use a variable to store the value of the next swf to load.
          • 2. Re: script to load out of external swf
            dizzy_nuts Level 1
            do you know of any example files, of how to do this, not that well up on scripting?

            cheers
            • 3. Re: script to load out of external swf
              dizzy_nuts Level 1
              do you know of any example files, of how to do this, not that well up on scripting?

              cheers
              • 4. Re: script to load out of external swf
                dizzy_nuts Level 1
                do you know of any example files, of how to do this, not that well up on scripting?

                cheers
                • 5. Re: script to load out of external swf
                  kglad Adobe Community Professional & MVP
                  i'm not sure which one you want to use. if it's the latter, no loop is needed:

                  • 6. Re: script to load out of external swf
                    dizzy_nuts Level 1
                    hi there
                    I tried this but nothing happened, do I need somekind of function code on the first frame or something???
                    • 7. Re: script to load out of external swf
                      kglad Adobe Community Professional & MVP
                      you need do no editing to the code above except to use the appropriate string instead of "nextswf.swf" and the correct frame label instead of "outro".
                      • 8. Re: script to load out of external swf
                        dizzy_nuts Level 1
                        tried it but still can't seem to get it to work, would you have a look at the fla files I have uploaded and downloadedable at http://www.pmrltd.co.uk/fla.zip

                        in folder:
                        main.fla
                        movie1.fla
                        movie2.fla


                        I've added the script on the buttons, called the outro frame 'exit' and added the script on the end of movie1 and movie2
                        • 9. Re: script to load out of external swf
                          kglad Adobe Community Professional & MVP
                          you haven't instantiated _level2: you can only access _level2 when something's there.

                          so, in main.swf you would use something like loadMovieNum("movie1.swf",2) to instantiate _level2.
                          • 10. Re: script to load out of external swf
                            dizzy_nuts Level 1
                            so say for example:
                            I have a drop down menu, within this I have the two buttons that load movie1.swf and movie2.swf. into level 2 for it to work properly the movie1, and 2 would need to load into a level lower than the main navigation movie otherwise movies1 + 2 would over lap the navigation, how can i prevent this, I set up a load.swf on this I put the script loadMovieNum ("navigation.swf", 6) so thinking that the navigation would load into level 6 and when the buttons are pressed would load movies1 +2 into level 2, but this doesn't seem to work, any suggestions??
                            • 11. Re: script to load out of external swf
                              kglad Adobe Community Professional & MVP
                              there should be no problem using your _level0 swf to load your navigation swf into _level6 and then use the buttons in your navigation swf to load movies into _level1 and _level2. what problem are you having?
                              • 12. Re: script to load out of external swf
                                dizzy_nuts Level 1
                                sorry for sounding dump with this just trying to get my head round it all, these are the problems:
                                1. I tried using on the buttons to load in external movies 1 + 2
                                on (release) {
                                _level2.nextSWFtoLoad="nextswf.swf";
                                _level2.gotoAndPlay("outro");
                                }
                                which is the code you gave me but I cant seem to get it working??

                                2. I cant seem to load the navigation on a higher level so that when say for example you roll over a drop down menu, that the button you press,loading in externals on level 2 below the navigation(on lets say level 6)

                                I just cant seem to get the externals to load in behind the navigation level??
                                is making any sense : (
                                • 13. Re: script to load out of external swf
                                  dizzy_nuts Level 1
                                  would you have a look at this for me, I got the over lapping sorted but used this script on the buttons!

                                  on (release) {
                                  _root.a.loadMovie("externalmovietoloadin.swf", 2);
                                  }

                                  and on the end of (end of the "exit" marker anim)of external movie loading in;

                                  loadMovieNum(nextSWFtoLoad, 2);

                                  all I need to do now then is some how when the buttons are pressed for loadin external, the outro anim on the movie already loaded to play before the new external loads in! for example I've got an outro anim on the external movies, I've given the frame a marker called 'outro' at the start of the outro animation, at the end frame of the this outro anim I've put
                                  loadMovieNum(nextSWFtoLoad, 2)

                                  so all I need is the script on the button to play the 'outro' marker. I've tried this, but with no joy

                                  on button:
                                  on (release) {
                                  _root.a.loadMovie("externalmovietoloadin.swf", 2);
                                  _root.a.gotoAndPlay("outro") //thinking it might go and play the outro of the already loaded movie
                                  }

                                  can you help : (


                                  • 14. Re: script to load out of external swf
                                    kglad Adobe Community Professional & MVP
                                    _root.a.loadMovie("externalmovietoloadin.swf", 2);

                                    loads externalmovietoloadin.swf into _root.a. your loadMovie() statement has nothing to do with _level2 or depth 2 or anything else with that 2. in fact, you should remove that 2 because flash is ignoring it and you're going to get confused by it.

                                    now, if you used:

                                    on (release) {
                                    _root.a.gotoAndPlay("outro");
                                    _root.a.nextSWFtoLoad="externalmovietoloadin.swf";
                                    }

                                    your outro would play and your loadMovieNum() statement at the end of the outro would load externalmovieloadin.swf into _level2. that would still leave _root.a on-stage so i don't think that's what you want.

                                    instead you probably want to use:

                                    this.loadMovie(nextSWFtoLoad);

                                    instead of that loadMovieNum() statement so the previous swf unloads and the next loads into the same target movieclip (_root.a).
                                    • 15. Re: script to load out of external swf
                                      dizzy_nuts Level 1
                                      am so confused : (

                                      I've tried putting what suggested on the button but again nothing happens! but when I have this it plays the external movie???

                                      on (release) {
                                      _root.a.loadMovie("externalmovietoloadin.swf", 2);
                                      }

                                      doh! what am I doing wrong?
                                      need some headache pills for this ; )
                                      • 16. Re: script to load out of external swf
                                        kglad Adobe Community Professional & MVP
                                        first, decide whether you want to load your external swfs into _root.a or _level2. let me know which you want to use.