ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.traits 

TimeTrait  - AS3 OSMF

Packageorg.osmf.traits
Classpublic class TimeTrait
InheritanceTimeTrait Inheritance MediaTraitBase Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

TimeTrait defines the trait interface for media that have a duration and a currentTime. It can also be used as the base class for a more specific TimeTrait subclass.

Use the MediaElement.hasTrait(MediaTraitType.TIME) method to query whether a media element has a trait of this type. If hasTrait(MediaTraitType.TIME) returns true, use the MediaElement.getTrait(MediaTraitType.TIME) method to get an object that is of this type.

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  currentTime : Number
[read-only] The current time of the media, in seconds.
TimeTrait
  duration : Number
[read-only] The duration of the media, in seconds.
TimeTrait
 InheritedtraitType : String
[read-only] The MediaTraitType for this trait.
MediaTraitBase
Public Methods
 MethodDefined By
  
TimeTrait(duration:Number = NaN)
Constructor.
TimeTrait
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Disposes of any resources used by this trait.
MediaTraitBase
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
  
Called just after the currentTime property has changed.
TimeTrait
  
Called immediately before the currentTime property is changed.
TimeTrait
  
Called just after the duration property has changed.
TimeTrait
  
Called immediately before the duration property is changed.
TimeTrait
  
Invoking this setter will result in the trait's currentTime value changing if it differs from currentTime's current value.
TimeTrait
  
Invoking this setter will result in the trait's duration value changing if it differs from duration's current value.
TimeTrait
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
  Dispatched when the currentTime of the trait has changed to a value equal to its duration.TimeTrait
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
  Dispatched when the duration of the trait changed.TimeTrait
Property Detail

currentTime

property
currentTime:Number  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The current time of the media, in seconds. Must never exceed the duration.



Implementation
    public function get currentTime():Number

duration

property 
duration:Number  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The duration of the media, in seconds.



Implementation
    public function get duration():Number
Constructor Detail

TimeTrait

()Constructor
public function TimeTrait(duration:Number = NaN)

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

Parameters
duration:Number (default = NaN) — The duration of the media, in seconds. The default is NaN (no duration).
Method Detail

currentTimeChangeEnd

()method
protected function currentTimeChangeEnd(oldCurrentTime:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Called just after the currentTime property has changed.

Parameters

oldCurrentTime:Number — Previous currentTime value.

currentTimeChangeStart

()method 
protected function currentTimeChangeStart(newCurrentTime:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Called immediately before the currentTime property is changed.

Subclasses can override this method to communicate the change to the media.

Parameters

newCurrentTime:Number — New currentTime value.

durationChangeEnd

()method 
protected function durationChangeEnd(oldDuration:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Called just after the duration property has changed. Dispatches the change event.

Subclasses that override should call this method to dispatch the durationChange event.

Parameters

oldDuration:Number — Previous duration value.

durationChangeStart

()method 
protected function durationChangeStart(newDuration:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Called immediately before the duration property is changed.

Subclasses can override this method to communicate the change to the media.

Parameters

newDuration:Number — New duration value.

setCurrentTime

()method 
protected final function setCurrentTime(value:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Invoking this setter will result in the trait's currentTime value changing if it differs from currentTime's current value.

Parameters

value:Number

setDuration

()method 
protected final function setDuration(value:Number):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Invoking this setter will result in the trait's duration value changing if it differs from duration's current value.

Parameters

value:Number
Event Detail

complete

Event
Event Object Type: org.osmf.events.TimeEvent
property TimeEvent.type = org.osmf.events.TimeEvent.COMPLETE

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the currentTime of the trait has changed to a value equal to its duration.

The TimeEvent.COMPLETE constant defines the value of the type property of the event object for a complete event.

durationChange

Event  
Event Object Type: org.osmf.events.TimeEvent
property TimeEvent.type = org.osmf.events.TimeEvent.DURATION_CHANGE

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the duration of the trait changed.

The TimeEvent.DURATION_CHANGE constant defines the value of the type property of the event object for a durationChange event.