mx.controls
Class MediaController



class MediaController
extends mx.core.UIComponent

The MediaController control complements the MediaDisplay control by providing a user interface that controls media playback using standard controls such as play and pause. The MediaController never loads or plays back media itself, instead it controls playback in a mediaPlayback or MediaDisplay control. The MediaController control features a "drawer" which exposes the contents of the playback controls when the user positions the mouse over it.

MXML Syntax

The <mx:MediacController> tag inherits all the properties of its parent classes, and the following properties:

 <mx:MediaController>
activePlayControl = "true|false"
associatedDisplay = "No default."
backgroundStyle = "default|none"
controllerPolicy = "auto|on|off"
enabled="true|false"
horizontal = "true|false"
playAtBegining = "true|false"
volume="75"
click = "Event handler. No default."
playheadChange = "Event handler. No default."
volumeChange = "Event handler. No default."
/>



Constructors
MediaController ()
Constructor.


Methods
      addSecondChrome(theChrome:Chrome, closedHeight:Number, openHeight:Number, closedWidth:Number, openWidth:Number, fixedEnd:Boolean) : Void
Adds a second chrome to the control.
      associateDisplay(d:MediaDisplay) : Void
Associates this MediaController control with a MediaDisplay control and sets up the event listeners between the two.
      broadcastEvent(eventType:String, detailArg) : Void
Broadcasts an event.
      contract(force:Boolean) : Void
If the policy is auto for this clip, contract the controller.
      evaluateToEnd() : Void
Enable or disable the Go to End button.
      expand(force:Boolean) : Void
If the policy is auto for this clip, expand the controller.
      getLoadPercent() : Number
This function is for the internal use of the controller only.
      getLocalizedString(id:String) : String
Gets the localized string.
      handleEvent(ev:Object) : Void
Handles events for which the controller listens.
      init() : Void
Initializes the controller.
      isListeningForPlayheadMoveEvent() : Boolean
Determines whether the controller is listening for playhead move events.
      isScrubbing() : Boolean
Determines whether the user is moving the thumb on the playback bar back and forth.
      measure() : Void
Sets the preferred measurements of the component.
      onMouseMove() : Void
Manually tracks mouse movement.
      removeSecondChrome() : Void
Remove the second chrome instance from the controller.
      setListeningForPlayheadMoveEvent(listen:Boolean) : Void
If true, the controller is listening for playhead move events.

Methods inherited from class mx.core.UIComponent
getFocus  setFocus  getFocusManager 

Methods inherited from class mx.core.UIObject
createAccessibilityImplementation  measure  doLater  cancelAllDoLaters  invalidate  invalidateStyle  invalidateProperties  invalidateSize  redraw  move  setSize  setSizeNoLayout  drawRect  fillRect  destroyLabel  createClassObject  createEmptyObject  destroyObject  getStyle  setMask  swapDepths 


Properties
staticversion:String  
MediaComponentVersion is for internal use only.
      playAtBeginning:Boolean  
If true, starts playing at the beginning of the media when the user clicks the Play button.
      controllerPolicy:String   [Read-Write]
Indicates how the controller behaves upon mouse interaction.
      horizontal:Boolean   [Read-Write]
If true, displays the control with a horizontal setting, and tracks the media from left to right.
      volume:Number   [Read-Write]
The volume level, specified by an integer from 0 to 100.
      backgroundStyle:String   [Read-Write]
If set to default, the component draws the chrome background.
      activePlayControl:String   [Read-Write]
Specifies the play state of the associated MediaDisplay control when loaded at runtime.
      playing:Boolean   [Read-Write]
Determines whether the controller is currently playing media.
      associatedDisplay:Void   [Write-Only]
MediaDisplay control associated with the MediaController control.
      enabled:Void   [Write-Only]
If true, enable this component.

Properties inherited from class mx.core.UIComponent
version  enabled  tabIndex 

Properties inherited from class mx.core.UIObject
version  nestLevel  dispatchEvent  addEventListener  handleEvent  removeEventListener  kStretch  styleName  className  setStyle  parentApplication  isDocument  parentDocument  documentDescriptor  descriptor  instanceIndices  repeaterIndices  getRepeaterItem  id  width  height  x  y  minHeight  minWidth  preferredHeight  preferredWidth  maxHeight  maxWidth  widthFlex  heightFlex  visible  scaleX  scaleY  alpha  depth  mouseX  mouseY  toolTip  baselinePosition 


Effects

Effects inherited from class mx.core.UIComponent
showEffect  hideEffect  focusInEffect  focusOutEffect 

Effects inherited from class mx.core.UIObject
creationCompleteEffect  moveEffect  resizeEffect  mouseDownEffect  mouseOverEffect  mouseOutEffect  mouseUpEffect 


Events
clickBroadcasts when the user clicks the Play/Pause button. The event object contains the properties:
- detail, which contains the string pause or play.
- target, which contains a reference to the control.
- type, which contains the string click.
playheadChangeBroadcasts when a user moves the playback slider or clicks the Go to Beginning or Go to End button. the event object contains the following properties:
- detail, which contains a number with the percent completed.
- type, which contains the string playheadChange.
volumeChangeBroadcasts when the user adjusts the volume. In MXML, use volumeChange as the property name. In ActionScript, use volume. The event object contains the following properties:
- detail, which contains an integer between 0 (minimum) and 100 (maximum) to indicate volume.
- type, which contains the string volume.
scrubbingBroadcasts when the user moves the thumb on the playback bar back and forth. Target contains a reference to the component that triggered the event. Type contains the name of the event.

Events inherited from class: mx.core.UIComponent
focusIn  focusOut  keyDown  keyUp  show  hide  valid  invalid  valueCommitted 

Events inherited from class: mx.core.UIObject
initialize  creationComplete  resize  move  draw  load  unload  mouseDown  mouseUp  mouseMove  mouseOver  mouseOut  mouseDownSomewhere  mouseUpSomewhere  mouseMoveSomewhere  mouseChangeSomewhere  effectStart  effectEnd  dragBegin  dragComplete  dragEnter  dragOver  dragExit  dragDrop 


Styles

Styles inherited from class mx.core.UIComponent
backgroundColor  backgroundDisabledColor  backgroundImage  backgroundAlpha  backgroundSize  barColor  borderCapColor  borderColor  buttonColor  borderStyle  disabledColor  errorColor  highlightColor  lineHeight  modalTransparency  scrollTrackColor  shadowColor  shadowCapColor  symbolColor  symbolBackgroundColor  symbolBackgroundDisabledColor  symbolBackgroundPressedColor  symbolDisabledColor  themeColor 

Styles inherited from class mx.core.UIObject
color  fontFamily  fontSize  fontStyle  fontWeight  textAlign  textDecoration  textIndent  marginLeft  marginRight  horizontalGap  verticalGap 


Constructor Detail

MediaController

MediaController()

Constructor.


Method Detail

addSecondChrome

addSecondChrome(theChrome:Chrome, closedHeight:Number, openHeight:Number, closedWidth:Number, openWidth:Number, fixedEnd:Boolean) : Void

Adds a second chrome to the control. Use this method to let the controller animate the chrome of the player in auto mode.

Parameters
     theChrome - Chrome background to use.
     closedHeight - Height when the MediaController controller is collapsed.
     openHeight - Height when the MediaController controller is expanded.
     closedWidth - Width when the MediaController controller is collapsed.
     openWidth - Width when the MediaController controller is expanded.
     fixedEnd - How the chrome is positioned when the component is resized. If the controller is at the bottom or right, the beginning is fixed. If the controller is positioned as the left or top, the end of the controller is fixed.


associateDisplay

associateDisplay(d:MediaDisplay) : Void

Associates this MediaController control with a MediaDisplay control and sets up the event listeners between the two.

Parameters
     d - Display instance.


broadcastEvent

broadcastEvent(eventType:String, detailArg) : Void

Broadcasts an event.

Parameters
     eventType - The type of event, such as play, stop, or pause.
     detailArg - The specific event type.


contract

contract(force:Boolean) : Void

If the policy is auto for this clip, contract the controller. Otherwise, do nothing, unless force is true.

Parameters
     force - If true, contract the controller.


evaluateToEnd

evaluateToEnd() : Void

Enable or disable the Go to End button.


expand

expand(force:Boolean) : Void

If the policy is auto for this clip, expand the controller. Otherwise, do nothing, unless force is true.

Parameters
     force - If true, expand the controller.


getLoadPercent

getLoadPercent() : Number

This function is for the internal use of the controller only. It is public so that subclips can access it.


getLocalizedString

getLocalizedString(id:String) : String

Gets the localized string.

Parameters
     id - ID of the string to retrieve.

Returns
     Value of the string.


handleEvent

handleEvent(ev:Object) : Void

Handles events for which the controller listens.

Parameters
     ev - Event.


init

init() : Void

Initializes the controller.


isListeningForPlayheadMoveEvent

isListeningForPlayheadMoveEvent() : Boolean

Determines whether the controller is listening for playhead move events.

Returns
     True if the controller is listening for playhead move events.


isScrubbing

isScrubbing() : Boolean

Determines whether the user is moving the thumb on the playback bar back and forth.


measure

measure() : Void

Sets the preferred measurements of the component.


onMouseMove

onMouseMove() : Void

Manually tracks mouse movement.


removeSecondChrome

removeSecondChrome() : Void

Remove the second chrome instance from the controller.


setListeningForPlayheadMoveEvent

setListeningForPlayheadMoveEvent(listen:Boolean) : Void

If true, the controller is listening for playhead move events.

Parameters
     listen - Whether to listen for playhead move events.


Property Detail

activePlayControl

activePlayControl:String   [Read-Write]

Specifies the play state of the associated MediaDisplay control when loaded at runtime. The default value is true, which plays the media file on load. Set this property to the same value as the autoPlay property of the associated MediadDsplay control. Note: It must be writable so it can be set by the Property inspector. However, it only pertains to the starting state of the component and should not be written under normal circumstances.


associatedDisplay

associatedDisplay:Void   [Write-Only]

MediaDisplay control associated with the MediaController control.


backgroundStyle

backgroundStyle:String   [Read-Write]

If set to default, the component draws the chrome background. If set to none, the component does not draw the chrome background. The default value is default.


controllerPolicy

controllerPolicy:String   [Read-Write]

Indicates how the controller behaves upon mouse interaction. Possible settings are on, off, and auto.
on: The controller is always expanded.
off: The controller is always contracted and can only be expanded programmatically.
auto: The controller is initially contracted. It expands when the mouse rolls over, and then contracts when the mouse rolls off.


enabled

enabled:Void   [Write-Only]

If true, enable this component. The default value is true.


horizontal

horizontal:Boolean   [Read-Write]

If true, displays the control with a horizontal setting, and tracks the media from left to right. If false, displays with a vertical orientation, and tracks the media from bottom to top.


playAtBeginning

playAtBeginning:Boolean  

If true, starts playing at the beginning of the media when the user clicks the Play button.


playing

playing:Boolean   [Read-Write]

Determines whether the controller is currently playing media.


version

static version:String  

MediaComponentVersion is for internal use only.


volume

volume:Number   [Read-Write]

The volume level, specified by an integer from 0 to 100. The default is 75.