9 Replies Latest reply: May 15, 2012 9:15 AM by kglad RSS

    embeded swf file

    cigowie

      i am using as2 and i want to embed a swf file into another swf project and have the embeded file play once the site is loaded can someone help please.

        • 1. Re: embeded swf file
          kglad MVP

          you can load a swf file into another swf using loadMovie(), loadMovieNum() or loadMovieClip().  is that what you want to do?

          • 2. Re: embeded swf file
            cigowie Community Member

            yes but when i load the site the clip does not start this is what i add to to action

             

             

            on(release)

            { this.loadMovie("mymovie.swf",moviswf); }

            • 3. Re: embeded swf file
              cigowie Community Member

              i am new to flash.  I include the above code and when i load the site i have to click on the movie and it will start, but i would like it to start as soon as the page load.  HELP!!!!!!!!!!

              • 4. Re: embeded swf file
                Ned Murphy MVP

                Just put the code that is inside the function in a frame of the timeline where the movie is...

                 

                     this.loadMovie("mymovie.swf",moviswf);

                 

                the rest of the code is what makes you need to click

                • 5. Re: embeded swf file
                  cigowie Community Member

                  are you saying i should put this in the action

                   

                  this.loadmovie("mymovie.swf",moviswf);

                   

                  because i try that and this is the error i get

                   

                  **Error** Scene=Scene 1, layer=otherswif, frame=1:Line 1: Statement must appear within on/onClipEvent handler
                       this.loadMovie("images.swf",moviswf);

                  Total ActionScript Errors: 1   Reported Errors: 1

                   

                  should i create a new layer to place this function or is it ok to place it in the action on the layer with the moviswf?

                  • 6. Re: embeded swf file
                    kglad MVP

                    do you want to load "mymovie.swf" when your main swf starts or when a button is clicked in your main swf? 

                     

                    if the former, assign your button an instance name (eg, btn) and attached to a frame (NOT the button or any other object), use:

                     

                    btn.onRelease=function(){

                    moviswf.loadMovie("mymovie.swf"); // assuming moviswf is a movieclip that you want to replace with mymovie.swf.  p.s.  watch your spelling of moviswf.  it's probable that should be movieswf

                    }

                     

                    if the later, just use:

                     

                    moviswf.loadMovie("mymovie.swf");

                    • 7. Re: embeded swf file
                      Ned Murphy MVP

                      That error is because you are attaching the code to the object, not the timeline.  Click on a frame and enter the code.

                      • 8. Re: embeded swf file
                        cigowie Community Member

                        thanks kglad, i want the fromer and I taught i got it but i am a newbie and i am not sure i understand how to do this

                        kglad wrote:

                         

                        assign your button an instance name (eg, btn) and attached to a frame (NOT the button or any other object),

                         

                        • 9. Re: embeded swf file
                          kglad MVP

                          click an empty part of the stage (to deselect everything), click your button (to select it) and in the properties panel you'll see a input field where you can type an instance name.

                           

                          if you don't see a properties panel, click windows > properties.