Packagecom.gestureworks.cml.element
Classpublic class MP3
InheritanceMP3 Inheritance ElementFactory Inheritance flash.display.Sprite
Subclasses MP3Element

The MP3 element loads an .MP3 file and plays it, with the options to pause, stop, seek, and resume play. The Mp3 element will automatically load any id3 data if it is present. The MP3 element also provides the option of a displaying graphical waveform by setting the display property to "waveform", otherwise "none". The waveform's color can also be set.
     
        var mp3Element:MP3 = new MP3();
        mp3Element.src = "RuthCalledShot_vbr.mp3";
        mp3Element.display = "waveform";
        mp3Element.backgroundAlpha = 0.5;
        mp3Element.backgroundColor = 0x333333;
        mp3Element.waveColor = 0x558855;
        mp3Element.volume = 1.0;
        mp3Element.pan = 0;
        mp3Element.loop = true;
        mp3Element.preload = true;
        mp3Element.autoplay = true;
        addChild(mp3Element);        
        mp3Element.init();
     
     



Public Properties
 PropertyDefined By
 Inheritedalpha : Number
[override] [write-only] sets the alpha for display objects
ElementFactory
  autoLoad : Boolean
Deprecated: Please Use preload
MP3
  autoplay : Boolean
Indicates whether the mp3 file plays upon load
MP3
  backgroundAlpha : Number
Sets the background alpha
MP3
  backgroundColor : uint
Sets the background color
MP3
 Inheritedblur : Boolean
Sets the drop shadow effect
ElementFactory
 Inheritedbottom : Number
sets the bottom value
ElementFactory
 Inheritedclass_ : String
Object's css class;
ElementFactory
 InheritedclassName : String
sets the class name of displayobject
ElementFactory
 InheritedcmlIndex : int
sets the cml index
ElementFactory
 InheriteddebugStyle : *
sets the debug style
ElementFactory
  display : String
Visualization display type, can be set to "waveform", "none", or an image URL.
MP3
 InheriteddisplayEvents : String
Use for dispatch completes.
ElementFactory
 InheriteddropShadow : Boolean
Sets the drop shadow effect
ElementFactory
  duration : Number
[read-only] Total duration
MP3
 Inheritedheight : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedheightPercent : String
sets the height percent of display object
ElementFactory
 InheritedhorizontalCenter : Number
sets the horizontal center of display object
ElementFactory
 Inheritedid : String
sets the id of child
ElementFactory
  id3 : ID3Info
[read-only] ID3 info object
MP3
  id3Album : String
[read-only] ID3 album
MP3
  id3Author : String
[read-only] ID3 author
MP3
  id3Comment : String
[read-only] ID3 Comment
MP3
  id3Copyright : String
[read-only] ID3 Copyright
MP3
  id3Title : String
[read-only] ID3 title
MP3
  id3Year : String
[read-only] ID3 Year
MP3
 Inheritedindex : int
sets the index of display object
ElementFactory
  isPlaying : Boolean
[read-only] Sets video playing status
MP3
 Inheritedleft : Number
sets left value
ElementFactory
  loop : Boolean
Specifies wether the mp3 file will to loop to the beginning and continue playing upon completion
MP3
  pan : Number
Sets the audio pannning ( -1 = left, 0 = center, 1 = right )
MP3
  percentLoaded : Number
[read-only] Percent of file loaded
MP3
  position : Number
[read-only] Playhead position in ms
MP3
  preload : Boolean
Indicates whether the mp3 file is preloaded by the cml parser
MP3
 InheritedpropertyStates : Array
Deprecated: Please Use state
ElementFactory
 Inheritedright : Number
sets the right value
ElementFactory
 Inheritedscale : Number
Sets both the x and y scale values
ElementFactory
 InheritedscaleX : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedscaleY : Number
[override] Sets width of the display object in pixels
ElementFactory
  src : String
Sets the mp3 file path
MP3
 Inheritedstate : Array
property states array
ElementFactory
  time : String
[read-only]
MP3
  TIME : String = Time
[static]
MP3
  timer : Timer
MP3
 Inheritedtop : Number
sets top value
ElementFactory
 InheritedverticalCenter : Number
sets the vertical center of display object
ElementFactory
  volume : Number
Sets the volume
MP3
  waveColor : uint
Sets the color of the waveform
MP3
 Inheritedwidth : Number
[override] Sets width of the display object in pixels
ElementFactory
 InheritedwidthPercent : String
sets the percent of width of display object
ElementFactory
Public Methods
 MethodDefined By
  
MP3()
Constructor
MP3
 Inherited
clone():*
Returns clone of self
ElementFactory
  
close():void
Closes mp3
MP3
  
[override] CML initialization callback
MP3
  
dispose():void
[override] Disposal method
MP3
  
init():void
[override] Initialisation method
MP3
  
open(file:String):void
Sets the src property from the argument and loads the mp3 file
MP3
 Inherited
parseCML(cml:XMLList):XMLList
parses cml file
ElementFactory
  
pause():void
Pauses playback
MP3
  
play():void
Plays from the beginning
MP3
 Inherited
postparseCML(cml:XMLList):void
post parses the cml file
ElementFactory
  
resume():void
Resumes playback from paused position
MP3
  
seek(pos:Number):void
Sets the mp3 playhead position in milliseconds
MP3
  
stop():void
Pauses playback and returns to the beginning
MP3
 Inherited
updateProperties(state:Number = 0):void
this method updates the properties
ElementFactory
Property Detail
autoLoadproperty
autoLoad:Boolean
Deprecated: Please Use preload


Implementation
    public function get autoLoad():Boolean
    public function set autoLoad(value:Boolean):void
autoplayproperty 
autoplay:Boolean

Indicates whether the mp3 file plays upon load

The default value is true.


Implementation
    public function get autoplay():Boolean
    public function set autoplay(value:Boolean):void
backgroundAlphaproperty 
backgroundAlpha:Number

Sets the background alpha

The default value is 1.0.


Implementation
    public function get backgroundAlpha():Number
    public function set backgroundAlpha(value:Number):void
backgroundColorproperty 
backgroundColor:uint

Sets the background color

The default value is 0x333333.


Implementation
    public function get backgroundColor():uint
    public function set backgroundColor(value:uint):void
displayproperty 
display:String

Visualization display type, can be set to "waveform", "none", or an image URL.

The default value is waveform.


Implementation
    public function get display():String
    public function set display(value:String):void
durationproperty 
duration:Number  [read-only]

Total duration


Implementation
    public function get duration():Number
id3property 
id3:ID3Info  [read-only]

ID3 info object


Implementation
    public function get id3():ID3Info
id3Albumproperty 
id3Album:String  [read-only]

ID3 album


Implementation
    public function get id3Album():String
id3Authorproperty 
id3Author:String  [read-only]

ID3 author


Implementation
    public function get id3Author():String
id3Commentproperty 
id3Comment:String  [read-only]

ID3 Comment


Implementation
    public function get id3Comment():String
id3Copyrightproperty 
id3Copyright:String  [read-only]

ID3 Copyright


Implementation
    public function get id3Copyright():String
id3Titleproperty 
id3Title:String  [read-only]

ID3 title


Implementation
    public function get id3Title():String
id3Yearproperty 
id3Year:String  [read-only]

ID3 Year


Implementation
    public function get id3Year():String
isPlayingproperty 
isPlaying:Boolean  [read-only]

Sets video playing status


Implementation
    public function get isPlaying():Boolean
loopproperty 
loop:Boolean

Specifies wether the mp3 file will to loop to the beginning and continue playing upon completion

The default value is false.


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

Sets the audio pannning ( -1 = left, 0 = center, 1 = right )

The default value is 0.


Implementation
    public function get pan():Number
    public function set pan(value:Number):void
percentLoadedproperty 
percentLoaded:Number  [read-only]

Percent of file loaded


Implementation
    public function get percentLoaded():Number
positionproperty 
position:Number  [read-only]

Playhead position in ms


Implementation
    public function get position():Number
preloadproperty 
preload:Boolean

Indicates whether the mp3 file is preloaded by the cml parser

The default value is true.


Implementation
    public function get preload():Boolean
    public function set preload(value:Boolean):void
srcproperty 
src:String

Sets the mp3 file path

The default value is .


Implementation
    public function get src():String
    public function set src(value:String):void
timeproperty 
time:String  [read-only]


Implementation
    public function get time():String
TIMEproperty 
public static var TIME:String = Time

timerproperty 
public var timer:Timer

volumeproperty 
volume:Number

Sets the volume

The default value is 1.


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

Sets the color of the waveform

The default value is 0xFFFFFF.


Implementation
    public function get waveColor():uint
    public function set waveColor(value:uint):void
Constructor Detail
MP3()Constructor
public function MP3()

Constructor

Method Detail
close()method
public function close():void

Closes mp3

displayComplete()method 
override public function displayComplete():void

CML initialization callback

dispose()method 
override public function dispose():void

Disposal method

init()method 
override public function init():void

Initialisation method

open()method 
public function open(file:String):void

Sets the src property from the argument and loads the mp3 file

Parameters

file:String — Full path and file name of mp3 file

pause()method 
public function pause():void

Pauses playback

play()method 
public function play():void

Plays from the beginning

resume()method 
public function resume():void

Resumes playback from paused position

seek()method 
public function seek(pos:Number):void

Sets the mp3 playhead position in milliseconds

Parameters

pos:Number — Number in ms

stop()method 
public function stop():void

Pauses playback and returns to the beginning