/* Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed under the BSD (revised) open source license */ package com.yahoo.astra.fl.events { import flash.events.Event; /** * The MediaEvent class defines events for the IMediaClip components. * * These events include the following: * */ public class MediaEvent extends Event { //-------------------------------------- // Constants //-------------------------------------- /** * Defines the value of the type property of an mediaPosition * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType mediaPosition */ public static const MEDIA_POSITION:String = "mediaPosition"; /** * Defines the value of the type property of an mediaPlayPause * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType mediaPlayPause */ public static const MEDIA_PLAY_PAUSE:String = "mediaPlayPause"; /** * Defines the value of the type property of an volumeChange * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType volumeChange */ public static const VOLUME_CHANGE:String = "volumeChange"; /** * Defines the value of the type property of an infoChange * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType infoChange */ public static const INFO_CHANGE:String = "infoChange"; /** * Defines the value of the type property of an mediaLoaded * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType mediaLoaded */ public static const MEDIA_LOADED:String = "mediaLoaded"; /** * Defines the value of the type property of an mediaEnded * event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelabletrue
currentTargetThe object that is actively processing * the event object with an event listener.
positionThe position of the playhead for the media * clip
durationThe length of the media clip
volumeThe volume of the media clip
muteThe volume of the media clip
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType mediaEnded */ public static const MEDIA_ENDED:String = "mediaEnded"; //-------------------------------------- // Constructor //-------------------------------------- /** * Constructor. Creates a new MediaEvent object with the specified parameters. * * @param type The event type; this value identifies the action that caused the event. * * @param bubbles Indicates whether the event can bubble up the display list hierarchy. * * @param cancelable Indicates whether the behavior associated with the event can be * prevented. * * @param position Indicates the position of the playhead * * @param duration Indicates the duration of the clip * * @param volume Indicates the volume of the clip * * @param mute Indicates whether the clip is muted */ public function MediaEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, position:Number = 0, duration:Number = 0, volume:Number = 1, mute:Boolean = false) { super(type, bubbles, cancelable); this.duration = duration; this.position = position; this.volume = volume; this.mute = mute; } //-------------------------------------- // Properties //-------------------------------------- /** * The position of the playhead */ public var position:Number = 0; /** * The length of the media object */ public var duration:Number = 0; /** * The volume level of the media object */ public var volume:Number = 0; /** * Boolean indicating whether or not the media object has been muted */ public var mute:Boolean = false; /** * Creates a copy of the MediaEvent object and sets the value of each parameter to match * the original. * * @return A new MediaEvent object with parameter values that match those of the original. */ override public function clone():Event { return new MediaEvent(this.type, this.bubbles, this.cancelable, this.position, this.duration, this.volume, this.mute); } } }