• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
May 11, 2012 May 11, 2012

Copy link to clipboard

Copied

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?

TOPICS
ActionScript

Views

826

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2012 May 11, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2012 May 11, 2012

Copy link to clipboard

Copied

LATEST

The function can not be interrupted during its execution.

If you remove the nextFrame() method, and put in its place anything except the gotoAndStop() gotoAndPlay() or prevFrame(), then the result is as follows:

   ...

onEnterFrameListener: start

onEnterFrameListener: end

onComplete

...

I can not understand why the function was suspended. No event can not abort the function before it is completed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines