Skip navigation
Eugeny Borisov
Currently Being Moderated

The handler of the Event.COMPLETE call from nextFrame () function. Mystic.

May 11, 2012 3:35 AM

package

{

       import flash.display.Loader;

      import flash.display.MovieClip;

       import flash.display.Sprite;

      import flash.events.Event;

      import flash.net.URLRequest;

 

 

public class Main extends Sprite

{

      private var loader:Loader;

      private var mc:MovieClip;

 

      public function Main():void

      {

           trace("entry point");

           loader = new Loader();

           loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

           loader.load(new URLRequest("some.swf"));

 

           mc = new MovieClip();

           mc.addEventListener(Event.ENTER_FRAME, onEnterFrameListener);

      }

 

      private function onComplete(e:Event):void

      {

           trace("onComplete");

           loader.removeEventListener(Event.COMPLETE, onComplete);

      }

      private function onEnterFrameListener(e:Event):void

      {

           trace("onEnterFrameListener: start");

           mc.nextFrame();//prevFrame(); gotoAndStop(); gotoAndPlay();

           trace("onEnterFrameListener: end");

      }

 

    }

 

}

 

 

result:

     ...

      onEnterFrameListener: start

      onComplete

      onEnterFrameListener: end

     ...

 

Why?

 
Replies
  • Currently Being Moderated
    May 11, 2012 4:15 AM   in reply to Eugeny Borisov

    It is not clear what you are asking "Why?" about.  If you are wondering why the onEnterFrame: start happens first it is probably because the ENTER_FRAME event listener is triggered before the file being loaded has finished being loaded.  What are your expectations?

     
    |
    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