4 Replies Latest reply: Apr 18, 2012 10:07 PM by msannie95 RSS

    How to proceed to next frame after the external swf finish playing

    msannie95

      I have some problems with my college project
      My flash can't proceed to next frame after the external swf finish playing
      I tried many times, but keep fail

       

      here is my AS code :

       

      banana_btn.addEventListener(MouseEvent.CLICK,press1);

      function press1(event:MouseEvent):void{

       

      var my_loader:Loader = new Loader();

      my_loader.load(new URLRequest("assignment.swf"));

      addChild(my_loader);

       

       

        my_loader.x = 25.00;

                          my_loader.y = 197.95;       

       

       

      }

       

       

      What should i add on in order to make it proceed to next frame ?

        • 1. Re: How to proceed to next frame after the external swf finish playing
          sinious Community Member

          Are you saying what you load, assignment.swf, isn't proceeding to the next frame? If so:

           

          function press1(event:MouseEvent):void
          {
               var my_loader:Loader = new Loader();
               my_loader.load(new URLRequest("assignment.swf"));
               addChild(my_loader);
           
               my_loader.x = 25;
                  my_loader.y = 198;
          
               my_loader.contentLoaderInfo(Event.COMPLETE, function (e:Event):void {
                    MovieClip(e.target.content).play();
               });
          }

           

           

          Or that once you load assignment.swf to the next frame

           

          function press1(event:MouseEvent):void
          {
               var my_loader:Loader = new Loader();
               my_loader.load(new URLRequest("assignment.swf"));
               addChild(my_loader);
           
           
               my_loader.x = 25;
                  my_loader.y = 198;
          
               play();
          }
          
          • 2. Re: How to proceed to next frame after the external swf finish playing
            Ned Murphy CommunityMVP

            If you mean you want to have the main file play after the loaded file is done playing... You will need to implement code in your external swf that either commands the parent file to go to the next frame when the it is done playing, or dispatches an event to indicate it is done playing for which you would assign a listener in the main file as soon as it has loaded.  If the loaded swf is a timeline-based animation another option could be to monitor the currentFrame property of the loaded swf , comparing it to its totalFrames property - when they are equal, it's done.

             

            Since this is a college project, that's about all I will offer... hopefully you can develop the code yourself, unless someone else doesn't mind helping you earn your grade..

            • 3. Re: How to proceed to next frame after the external swf finish playing
              msannie95 Community Member

              Hmmmmm

              I means i would like to go to next frame in the main file after the external swf done playing
              I tried many times such as comparing it with current and total frames
              But it always show error : undefined property
              How to define the current and total frames?

              • 4. Re: How to proceed to next frame after the external swf finish playing
                msannie95 Community Member

                Ned Murphy wrote:

                 

                If you mean you want to have the main file play after the loaded file is done playing... You will need to implement code in your external swf that either commands the parent file to go to the next frame when the it is done playing, or dispatches an event to indicate it is done playing for which you would assign a listener in the main file as soon as it has loaded.  If the loaded swf is a timeline-based animation another option could be to monitor the currentFrame property of the loaded swf , comparing it to its totalFrames property - when they are equal, it's done.

                 

                Since this is a college project, that's about all I will offer... hopefully you can develop the code yourself, unless someone else doesn't mind helping you earn your grade..

                 

                 

                 

                I understand what you written
                but i really have no idea with the code

                Can you give more hints to me?