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 

BufferTrait  - AS3 OSMF

Packageorg.osmf.traits
Classpublic class BufferTrait
InheritanceBufferTrait Inheritance MediaTraitBase Inheritance EventDispatcher Inheritance Object

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

BufferTrait defines the trait interface for media that can use a data buffer. It can also be used as the base class for a specific BufferTrait subclass.

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

Related API Elements



Public Properties
 PropertyDefined By
  buffering : Boolean
[read-only] Indicates whether the media is currently buffering.
BufferTrait
  bufferLength : Number
[read-only] The length of the content currently in the media's buffer in seconds.
BufferTrait
  bufferTime : Number
The desired length of the media's buffer in seconds.
BufferTrait
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedtraitType : String
[read-only] The MediaTraitType for this trait.
MediaTraitBase
Public Methods
 MethodDefined By
  
Constructor.
BufferTrait
 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 buffering has changed.
BufferTrait
  
Called immediately before the buffering value is changed.
BufferTrait
  
Called just after the bufferLength value has changed.
BufferTrait
  
Called immediately before the bufferLength value is changed.
BufferTrait
  
Called just after the bufferTime value has changed.
BufferTrait
  
Called immediately before the bufferTime value is changed.
BufferTrait
  
Indicates whether the trait is in a buffering state.
BufferTrait
  
Defines the value of the bufferLength property.
BufferTrait
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 trait's buffering property has changed.BufferTrait
  Dispatched when the trait's bufferTime property has changed.BufferTrait
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

buffering

property
buffering:Boolean  [read-only]

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

Indicates whether the media is currently buffering.

The default is false.



Implementation
    public function get buffering():Boolean

bufferLength

property 
bufferLength:Number  [read-only]

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

The length of the content currently in the media's buffer in seconds.



Implementation
    public function get bufferLength():Number

bufferTime

property 
bufferTime:Number

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

The desired length of the media's buffer in seconds.

If the passed value is not numerical or negative, it is forced to zero.

The default is zero.



Implementation
    public function get bufferTime():Number
    public function set bufferTime(value:Number):void
Constructor Detail

BufferTrait

()Constructor
public function BufferTrait()

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

Constructor.

Method Detail

bufferingChangeEnd

()method
protected function bufferingChangeEnd():void

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

Called just after buffering has changed. Dispatches the change event.

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

bufferingChangeStart

()method 
protected function bufferingChangeStart(newBuffering:Boolean):void

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

Called immediately before the buffering value is changed.

Subclasses implement this method to communicate the change to the media.

Parameters

newBuffering:Boolean — New buffering value.

bufferLengthChangeEnd

()method 
protected function bufferLengthChangeEnd():void

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

Called just after the bufferLength value has changed.

bufferLengthChangeStart

()method 
protected function bufferLengthChangeStart(newSize:Number):void

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

Called immediately before the bufferLength value is changed. Subclasses implement this method to communicate the change to the media.

Parameters

newSize:Number — New bufferLength value.

bufferTimeChangeEnd

()method 
protected function bufferTimeChangeEnd():void

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

Called just after the bufferTime value has changed. Dispatches the change event.

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

bufferTimeChangeStart

()method 
protected function bufferTimeChangeStart(newTime:Number):void

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

Called immediately before the bufferTime value is changed. Subclasses implement this method to communicate the change to the media.

Parameters

newTime:Number — New bufferTime value.

setBuffering

()method 
protected final function setBuffering(value:Boolean):void

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

Indicates whether the trait is in a buffering state. Dispatches a bufferingChange event if invocation results in the buffering property changing.

Parameters

value:Boolean

setBufferLength

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

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

Defines the value of the bufferLength property.

This method fires a BufferLengthChangeEvent if the value's change persists.

Parameters

value:Number
Event Detail

bufferingChange

Event
Event Object Type: org.osmf.events.BufferEvent
property BufferEvent.type = org.osmf.events.BufferEvent.BUFFERING_CHANGE

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

Dispatched when the trait's buffering property has changed.

The BufferEvent.BUFFERING_CHANGE constant defines the value of the type property of the event object for a bufferingChange event.

bufferTimeChange

Event  
Event Object Type: org.osmf.events.BufferEvent
property BufferEvent.type = org.osmf.events.BufferEvent.BUFFER_TIME_CHANGE

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

Dispatched when the trait's bufferTime property has changed.

The BufferEvent.BUFFER_TIME_CHANGE constant defines the value of the type property of the event object for a bufferTimeChange event.