Skip navigation
msannie95
Currently Being Moderated

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

Apr 18, 2012 11:58 AM

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 ?

 
Replies
  • Currently Being Moderated
    Apr 18, 2012 12:17 PM   in reply to msannie95

    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();
    }
    
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:01 PM   in reply to msannie95

    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..

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points