17 Replies Latest reply on Dec 15, 2008 4:21 AM by Ned Murphy

    loadMovie at a specific frame?

    Opie2 Level 1
      Is it possible to get a movie to load at a specific frame?


        • 1. Re: loadMovie at a specific frame?
          Ned Murphy Adobe Community Professional & MVP
          Blindly, I'd say yes... put the code in the frame into which you want to load the movie. But your question can be translated a few ways, so you may need to be more descriptive with your intentions.
          • 2. Re: loadMovie at a specific frame?
            Opie2 Level 1
            I have one main movie that contains four buttons. When a button is released, I want a second movie to load, but on a specific frame. I can load the second movie, but haven't figured out how to load it at a particular frame name.

            In addition, when it switches back and forth between movies, there's a white "flash", that I can't seem to get around either.

            Any suggestions?

            Thanks!
            • 3. Re: loadMovie at a specific frame?
              Ned Murphy Adobe Community Professional & MVP
              Do you mean you want to load the movie on a particular frame of the main timeline? Or do you mean you want the loaded movie to go to a specific frame within itself?
              • 4. Re: loadMovie at a specific frame?
                :::@::: Level 1
                quote:

                Originally posted by: NedWebs
                Do you mean you want to load the movie on a particular frame of the main timeline? Or do you mean you want the loaded movie to go to a specific frame within itself?


                I would say the second option suffices. In every way the whole movie HAS to be loaded, so after loading it just tell it to goto and play to the specific frame.


                • 5. Re: loadMovie at a specific frame?
                  Opie2 Level 1
                  Yes, the second option is the way to go. I'm just really a moron when it comes to actionscript and haven't found what I need to put in the script I have to make it go to a specific frame name in the second movie. I get it to play the proper movie and get it back to the original one, but the actual frame...haven't got that yet.
                  • 6. Re: loadMovie at a specific frame?
                    Ned Murphy Adobe Community Professional & MVP
                    There are no (well, maybe a few) morons when it comes to actionscript--most are just tortured souls that eventually find enlightenment.

                    What code did you use to load the movie?
                    • 7. Re: loadMovie at a specific frame?
                      Opie2 Level 1
                      Well, this particular project has definitely been torturous! It's been one issue after another. Looking at the bright side though, it's been a great learning experience.

                      on (release) {
                      _root.contents.loadMovie("PopupTestRev.swf",1);
                      }

                      • 8. Re: loadMovie at a specific frame?
                        Ned Murphy Adobe Community Professional & MVP
                        In my opinion it's the best way to learn it... lose hair, sleep, track of time, etc....

                        The primary reason I asked for your code was to determine which version of actionscript you're using.

                        What you'll want to do is change to using loadClip(). The reason being that you need to wait until the swf file is loaded before you try to deal with it. loadMovie doesn't have a supporting cast that can detect that occurence, but loadClip does.

                        Here's some code that you should play with separately in a new file to see it working, then you can figure out how to adapt it to your scenario.

                        • 9. Re: loadMovie at a specific frame?
                          Opie2 Level 1
                          I've done tutorials galore and am still hoping for an actionScipt epiphany for me. I've been struggling with this project for over a week now. I had estimated that it would only take a few hours to get done.

                          Your solution works excellent, except now it's doing something strange.

                          In the second movie there's an xml menu. When I go back to the first movie from the second movie, the xml still shows even though there's no xml in the first movie. Should there be some sort of unload movie or xml script in the second movie maybe?
                          • 10. loadMovie at a specific frame?
                            Ned Murphy Adobe Community Professional & MVP
                            Maybe... if the menu is dynamically created, then it doesn't really have a timeline of its own as a home. So you can either try removing it before you close the second movie or you can dynamically create it in a blank movieclip/container manually pre-planted in the second movie. The second way will give it a timeline home in the second movie.
                            • 11. Re: loadMovie at a specific frame?
                              Opie2 Level 1
                              I've been trying everything I can think of, and nothing's working. The xml won't go away.

                              Help!
                              • 12. Re: loadMovie at a specific frame?
                                Ned Murphy Adobe Community Professional & MVP
                                What code are you using for loading the xml menu? Did youi try targeting it to a load into a static blank movieclip in the second movie?
                                • 13. Re: loadMovie at a specific frame?
                                  Opie2 Level 1
                                  I've put it in the second movie, but it doesn't work. I get this error:
                                  Error opening URL 'file/Assets/undefined'

                                  This is the code I have attached to the empty movie clip

                                  onClipEvent (enterFrame) {
                                  _root.contents.loadMovie(menu1.swf);
                                  }
                                  • 14. loadMovie at a specific frame?
                                    Ned Murphy Adobe Community Professional & MVP
                                    I'm getting a bit confused between things, but refering to _root will likely be targeting the main movie that loads the second movie. Try replacing _root with "this" (no quotes).

                                    Is contents the name of the blank movieclip in the second movie?

                                    Also, don't use the enterFrame part of that, just keep the line of code by itself. enterFrame will continuously perform that operation while it's in that frame. Actually, you probably only need to have... this.loadMovie("menu1.swf"); in the keyframe within that empty movieclip (not attached to it)
                                    • 15. Re: loadMovie at a specific frame?
                                      Opie2 Level 1
                                      Yes, "contents" is the name of the blank movie clip. I have a separate movie, menu1.swf (that contains the xml menu) that I was hoping would load into it. Unfortunately, it doesn't.

                                      onClipEvent () {
                                      this.contents.loadMovie(menu1.swf);
                                      }

                                      • 16. Re: loadMovie at a specific frame?
                                        Ned Murphy Adobe Community Professional & MVP
                                        Get rid of the event part of that... remove any code 'attached' to contents. In the one and only frame inside contents place... loadMovie("menu1.swf", this);
                                        • 17. Re: loadMovie at a specific frame?
                                          Ned Murphy Adobe Community Professional & MVP
                                          It didn't dawn on me until after I had shut down my machine for the night, but the only problem that you might be having with the menu in the second movie may be that you had used a _root reference to load the menu.

                                          When the second movie is loaded into the first, the first becomes the _root, so if the menu was being loaded to the _root, it was loading into the first movie.

                                          If you can revert to what you had originally for the the second movie, then if you place...

                                          this._lockroot = true;

                                          as the first line of code in the first frame of that second movie, any reference to _root involved within that second movie will be in reference to it and not the first movie.