2 Replies Latest reply: May 11, 2012 6:07 AM by Eugeny Borisov RSS

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

    Eugeny Borisov

      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?