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 

AudioTrait  - AS3 OSMF

Packageorg.osmf.traits
Classpublic class AudioTrait
InheritanceAudioTrait Inheritance MediaTraitBase Inheritance EventDispatcher Inheritance Object

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

AudioTrait defines the trait interface for media that have audio. It can also be used as the base class for a specific AudioTrait class.

Use the MediaElement.hasTrait(MediaTraitType.AUDIO_TRAIT) method to query whether a media element has this trait. If hasTrait(MediaTraitType.AUDIO_TRAIT) returns true, use the MediaElement.getTrait(MediaTraitType.AUDIO_TRAIT) method to get an object 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
  muted : Boolean
Indicates whether the AudioTrait is muted or sounding.
AudioTrait
  pan : Number
The left-to-right panning of the sound.
AudioTrait
 InheritedtraitType : String
[read-only] The MediaTraitType for this trait.
MediaTraitBase
  volume : Number
The volume, ranging from 0 (silent) to 1 (full volume).
AudioTrait
Public Methods
 MethodDefined By
  
Constructor.
AudioTrait
 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 muted property has been toggled.
AudioTrait
  
Called immediately before the muted value is toggled.
AudioTrait
  
Called just after the pan value has changed.
AudioTrait
  
Called immediately before the pan value is changed.
AudioTrait
  
Called just after the volume value has changed.
AudioTrait
  
Called immediately before the volume value is changed.
AudioTrait
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
  Dispatched when the trait's muted property has changed.AudioTrait
  Dispatched when the trait's pan property has changed.AudioTrait
  Dispatched when the trait's volume property has changed.AudioTrait
Property Detail

muted

property
muted:Boolean

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

Indicates whether the AudioTrait is muted or sounding.

Changing the value of the muted property does not affect the value of the volume property.

The default value is false.



Implementation
    public function get muted():Boolean
    public function set muted(value:Boolean):void

Related API Elements

pan

property 
pan:Number

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

The left-to-right panning of the sound. Ranges from -1 (full pan left) to 1 (full pan right).

Passing a value greater than 1 sets the value to 1. Passing a value less than -1 sets the value to -1.

The default is zero.



Implementation
    public function get pan():Number
    public function set pan(value:Number):void

volume

property 
volume:Number

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

The volume, ranging from 0 (silent) to 1 (full volume).

Passing a value greater than 1 sets the value to 1. Passing a value less than zero sets the value to zero.

Changing the value of the volume property does not affect the value of the muted property.

The default is 1.



Implementation
    public function get volume():Number
    public function set volume(value:Number):void

Related API Elements

Constructor Detail

AudioTrait

()Constructor
public function AudioTrait()

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

Constructor.

Method Detail

mutedChangeEnd

()method
protected function mutedChangeEnd():void

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

Called just after the muted property has been toggled. Dispatches the change event.

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

mutedChangeStart

()method 
protected function mutedChangeStart(newMuted:Boolean):void

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

Called immediately before the muted value is toggled.

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

Parameters

newMuted:Boolean — New muted value.

panChangeEnd

()method 
protected function panChangeEnd():void

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

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

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

panChangeStart

()method 
protected function panChangeStart(newPan:Number):void

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

Called immediately before the pan value is changed.

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

Parameters

newPan:Number — New pan value.

volumeChangeEnd

()method 
protected function volumeChangeEnd():void

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

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

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

volumeChangeStart

()method 
protected function volumeChangeStart(newVolume:Number):void

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

Called immediately before the volume value is changed.

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

Parameters

newVolume:Number — New volume value.
Event Detail

mutedChange

Event
Event Object Type: org.osmf.events.AudioEvent
property AudioEvent.type = org.osmf.events.AudioEvent.MUTED_CHANGE

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

Dispatched when the trait's muted property has changed.

The AudioEvent.MUTED_CHANGE constant defines the value of the type property of the event object for a mutedChange event.

panChange

Event  
Event Object Type: org.osmf.events.AudioEvent
property AudioEvent.type = org.osmf.events.AudioEvent.PAN_CHANGE

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

Dispatched when the trait's pan property has changed.

The AudioEvent.PAN_CHANGE constant defines the value of the type property of the event object for a panChange event.

volumeChange

Event  
Event Object Type: org.osmf.events.AudioEvent
property AudioEvent.type = org.osmf.events.AudioEvent.VOLUME_CHANGE

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

Dispatched when the trait's volume property has changed.

The AudioEvent.VOLUME_CHANGE constant defines the value of the type property of the event object for a volumeChange event.