Packagecv.data
Classpublic dynamic class PlayList
Implementsflash.events.IEventDispatcher
SubclassesASX, ATOM, B4S, M3U, PLS, XSPF

The PlayList class extends the Array class and enables the management of a list of items. This includes selecting next, previous, repeat, repeat all, and shuffling. Also allows for a current index, so the selected item can be tracked.



Public Properties
 PropertyDefined by
  index : uint
Gets or sets the current selected item in the playlist.
PlayList
  nextIndex : int
[read-only] Gets the index of the next item in the playlist.
PlayList
  previousIndex : int
[read-only] Gets the index of the previous item in the playlist.
PlayList
  repeat : Boolean
Gets or sets whether an item is repeated after it's finished.
PlayList
  repeatAll : Boolean
Gets or sets whether the playlist repeats when it's finished.
PlayList
  shuffle : Boolean
Gets or sets whether shuffle is enabled or not.
PlayList
Public Methods
 MethodDefined by
  
PlayList
  
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.
PlayList
  
dispatchEvent(evt:Event):Boolean
Dispatches an event into the event flow.
PlayList
  
getCurrent():Object
Returns the current item from the playlist
PlayList
  
getNext():Object
Returns the next item from the playlist.
PlayList
  
getPrevious():Object
Returns the previous item from the playlist.
PlayList
  
getRandom():Object
Returns a random item from the playlist.
PlayList
  
Returns a random index from the playlist.
PlayList
  
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
PlayList
  
inPlayList(item:Object):Boolean
Searchs the playlist to determin if an item is listed.
PlayList
  
remove(item:Object):Boolean
Removes the given item from the playlist.
PlayList
  
removeAt(idx:uint):Boolean
Removes an item at a given index.
PlayList
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
PlayList
  
Converts the PlayList to a DataProvider for use with components.
PlayList
  
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
PlayList
Protected Methods
 MethodDefined by
  
setMimes():void
Sets the mimetypes allowed by PlayList.
PlayList
  
toSeconds(str:String):int
Converts a string version of a time format into the seconds equivalent.
PlayList
Events
 EventSummaryDefined by
   Dispatched when the index has changed or getNext() and getPrevious() were called.PlayList
   Dispatched when the playlist has reached the end of the playlist.PlayList
   Dispatched when the playlist has started playing the first item.PlayList
Public Constants
 ConstantDefined by
  CHANGE : String = "change"
[static] The PlayList.CHANGE constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has changed in some way.
PlayList
  END_OF_LIST : String = "endoflist"
[static] The PlayList.END_OF_LIST constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has reached the end of the list.
PlayList
  START_OF_LIST : String = "startoflist"
[static] The PlayList.START_OF_LIST constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has reached the beginning of the list.
PlayList
Property detail
indexproperty
index:uint  [read-write]

Gets or sets the current selected item in the playlist.

The default value is 0.

Implementation
    public function get index():uint
    public function set index(value:uint):void

See also

nextIndexproperty 
nextIndex:int  [read-only]

Gets the index of the next item in the playlist.

Implementation
    public function get nextIndex():int

See also

previousIndexproperty 
previousIndex:int  [read-only]

Gets the index of the previous item in the playlist.

Implementation
    public function get previousIndex():int

See also

repeatproperty 
repeat:Boolean  [read-write]

Gets or sets whether an item is repeated after it's finished.

The default value is false.

Implementation
    public function get repeat():Boolean
    public function set repeat(value:Boolean):void
repeatAllproperty 
repeatAll:Boolean  [read-write]

Gets or sets whether the playlist repeats when it's finished.

The default value is false.

Implementation
    public function get repeatAll():Boolean
    public function set repeatAll(value:Boolean):void
shuffleproperty 
shuffle:Boolean  [read-write]

Gets or sets whether shuffle is enabled or not.

The default value is false.

Implementation
    public function get shuffle():Boolean
    public function set shuffle(value:Boolean):void
Constructor detail
PlayList()constructor
public function PlayList(dp:DataProvider = null)Parameters
dp:DataProvider (default = null)
Method detail
addEventListener()method
public function 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. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

Parameters
type:String The type of event.
 
listener:Function The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing, as this example shows: function(evt:Event):void The function can have any name.
 
useCapture:Boolean (default = false) Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true, the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener twice, once with useCapture set to true, then again with useCapture set to false.
 
priority:int (default = 0) The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
 
useWeakReference:Boolean (default = false) Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not. Class-level member functions are not subject to garbage collection, so you can set useWeakReference to true for class-level member functions without subjecting them to garbage collection. If you set useWeakReference to true for a listener that is a nested inner function, the function will be garbage-collected and no longer persistent. If you create references to the inner function (save it in another variable) then it is not garbage-collected and stays persistent.
dispatchEvent()method 
public function dispatchEvent(evt:Event):Boolean

Dispatches an event into the event flow. The event target is the EventDispatcher object upon which the dispatchEvent() method is called.

Parameters
evt:Event The Event object that is dispatched into the event flow. If the event is being redispatched, a clone of the event is created automatically. After an event is dispatched, its target property cannot be changed, so you must create a new copy of the event for redispatching to work.

Returns
Boolean A value of true if the event was successfully dispatched. A value of false indicates failure or that preventDefault() was called on the event.
getCurrent()method 
public function getCurrent():Object

Returns the current item from the playlist

Returns
Object The current item
getNext()method 
public function getNext():Object

Returns the next item from the playlist.

Returns
Object The next item

See also

getPrevious()method 
public function getPrevious():Object

Returns the previous item from the playlist.

Returns
Object The previous item

See also

getRandom()method 
public function getRandom():Object

Returns a random item from the playlist.

Returns
Object The item selected at random

See also

getRandomIndex()method 
public function getRandomIndex():uint

Returns a random index from the playlist.

Returns
uint The index randomly selected

See also

hasEventListener()method 
public function hasEventListener(type:String):Boolean

Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type actually triggers an event listener, use willTrigger().

Parameters
type:String The type of event.

Returns
Boolean A value of true if a listener of the specified type is registered; false otherwise.
inPlayList()method 
public function inPlayList(item:Object):Boolean

Searchs the playlist to determin if an item is listed.

Parameters
item:Object The item to be checked for.

Returns
Boolean Whether the item is in the playlist or not.
remove()method 
public function remove(item:Object):Boolean

Removes the given item from the playlist.

Parameters
item:Object The item object to be removed

Returns
Boolean Whether the removal was successful or not.
removeAt()method 
public function removeAt(idx:uint):Boolean

Removes an item at a given index.

Parameters
idx:uint The index of the item to be removed.

Returns
Boolean Whether the removal was successful or not.
removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Parameters
type:String The type of event.
 
listener:Function The listener object to remove.
 
useCapture:Boolean (default = false) Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener() are required to remove both, one call with useCapture() set to true, and another call with useCapture() set to false.
setMimes()method 
protected function setMimes():void

Sets the mimetypes allowed by PlayList.

toDataProvider()method 
public function toDataProvider():DataProvider

Converts the PlayList to a DataProvider for use with components.

Returns
DataProvider — The DataProvider equivalent of the playlist.
toSeconds()method 
protected function toSeconds(str:String):int

Converts a string version of a time format into the seconds equivalent.

Parameters
str:String The string to convert.

Returns
int The number of seconds for the given time.
willTrigger()method 
public function willTrigger(type:String):Boolean

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.

Parameters
type:String The type of event.

Returns
Boolean A value of true if a listener of the specified type will be triggered; false otherwise.
Event detail
changeevent 
Event object type: flash.events.Event

Dispatched when the index has changed or getNext() and getPrevious() were called.

See also

endoflistevent  
Event object type: flash.events.Event

Dispatched when the playlist has reached the end of the playlist.

See also

startoflistevent  
Event object type: flash.events.Event

Dispatched when the playlist has started playing the first item.

See also

Constant detail
CHANGEconstant
public static const CHANGE:String = "change"

The PlayList.CHANGE constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has changed in some way.

END_OF_LISTconstant 
public static const END_OF_LIST:String = "endoflist"

The PlayList.END_OF_LIST constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has reached the end of the list.

START_OF_LISTconstant 
public static const START_OF_LIST:String = "startoflist"

The PlayList.START_OF_LIST constant defines the value of the type property of the event object that is dispatched to indicate that the playlist has reached the beginning of the list.