Suche…


Bemerkungen

Frame-basierte Animationen in Flash und AIR implementieren den folgenden Lebenszyklus:

  • Event.ENTER_FRAME wird Event.ENTER_FRAME
  • Konstruktorcode von untergeordneten Anzeigeobjekten wird ausgeführt
  • Event.FRAME_CONSTRUCTED wird Event.FRAME_CONSTRUCTED
  • Frame-Aktionen im MovieClip Symbol werden ausgeführt
  • MovieClip in MovieClip Symbolen werden ausgeführt
  • Event.EXIT_FRAME wird Event.EXIT_FRAME
  • Event.RENDER wird Event.RENDER

Hinzugefügt und aus dem Bühnenlebenszyklus entfernt

package {
import flash.display.Sprite;
import flash.events.Event;

public class Viewport extends Sprite {

    /** Constructor */
    public function Viewport() {
        super();

        // Listen for added to stage event
        addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
    }

    /** Added to stage handler */
    protected function addedToStageHandler(event:Event):void {
        // Remove added to stage event listener
        removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);

        // Listen for removed from stage event
        addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
    }

    /** Removed from stage handler */
    protected function removedFromStageHandler(event:Event):void {
        // Remove removed from stage event listener
        removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);

        // Listen for added to stage event
        addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
    }

    /** Dispose */
    public function dispose():void {
        // Remove added to stage event listener
        removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);

        // Remove removed from stage event listener
        removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
    }

}
}


Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow