9 Replies Latest reply on Nov 23, 2010 5:46 AM by kglad

    Inserting a .swf into a .fla

      Hey I am trying to insert an external music player "jukebox.swf" into a .fla

       

      I don't really know how to load a .swf into the project.  How can I get this to work?

       

      Thanks.

        • 1. Re: Inserting a .swf into a .fla
          kglad Adobe Community Professional & MVP

          you can use loadMovie() or loadMovieNum() or the moviecliploader class'es loadClip().

          • 2. Re: Inserting a .swf into a .fla
            Level 1

            Yes, but, well I guess I should have mentioned I'm a newbie to Flash.... How do I literally script it out?  I mean the file name is jukebox.swf, so where do I put that file in order to be loaded and what is the script that needed to be loaded?

             

            Thanks.

            • 3. Re: Inserting a .swf into a .fla
              kglad Adobe Community Professional & MVP

              the easiest thing to do is put jukebox.swf in the same directory with your loading html and swf.  you can then use:

               

              this.createEmptyMovieClip("mc",1);

              mc.loadMovie("jukebox.swf");

              • 4. Re: Inserting a .swf into a .fla
                Level 1

                That works great!  Thanks!  But now how can I change the coordinates of the .swf?  It's all the way in the top left.

                • 5. Re: Inserting a .swf into a .fla
                  kglad Adobe Community Professional & MVP

                  you're welcome.

                   

                  all of the properties of the loaded swf you control by referencing the target movieclip into which it was loaded:  mc

                   

                  so, if you want to position your loaded swf at _x = 100, _y = 200, use:

                   

                  mc._x = 100;

                  mc._y = 200;

                   

                  note:  some properties cannot be set until loading is complete.

                   

                  p.s.  if this thread is answered, please mark it as answered.

                  • 6. Re: Inserting a .swf into a .fla
                    awingandaprayer2

                    Hi there!

                     

                    I was extremely glad to find this post, as it helped me with this same issue, however, in implementing this, it created another issue. I inserted my movieclip exactly as shown, and it works tremendously, except that it now loops continuously. I have tried inserting a stop();  function on the clip's timeline after the mc ends, on its own seperate timeline..it doesn't work no matter where I put it. I do not have just a single actions layer, if that makes any difference.

                     

                    So my question is, what code stops the mc from looping and where would I put it? the clips code is as follows;

                     

                    this.createEmptyMovieClip("mc",1);

                     

                    mc.loadMovie("dnbanner2.swf");

                     

                    mc._x = 140;

                     

                    mc._y = 13;

                     

                     

                    Any help would be very greatly appreciated, I have been at it for days and many, many browsed forums

                    • 7. Re: Inserting a .swf into a .fla
                      kglad Adobe Community Professional & MVP

                      a stop() anywhere on dnbanner2's main timeline would stop the main timeline.

                       

                      if it's not possible to edit dnbanner2.swf and place a stop there. you could apply a stop() to mc when you wanted to stop dnbanner2's main timeline:

                       

                      mc.stop();

                       

                      most commonly that would be applied when dnbanner2's main timeline has reached its last frame.  to determine when that occurs, you would use a loop to track the play-progress of dnbanner2's main timeline:

                       

                      this.onEnterFrame=function(){

                      if(mc._currentframe==mc._totalframes){

                      mc.stop();

                      delete this.onEnterFrame;

                      }

                      }

                      • 8. Re: Inserting a .swf into a .fla
                        pagsarmingan Level 1

                        Mine has an error it says:

                         

                        1120: Access of undefined property mc.??

                        • 9. Re: Inserting a .swf into a .fla
                          kglad Adobe Community Professional & MVP

                          you don't have a movieclip with instance name mc.