MediaController

Kind of class:class
Inherits from:UIComponent < UIObject < MovieClip
Classpath:mx.controls.MediaController
File last modified:Tuesday, 18 December 2007, 15:44:37

Summary


Constructor
Class properties
Instance properties
Class methods
Class methods inherited from UIObject
Instance methods
Event handlers
Event handlers inherited from UIComponent

Constructor

MediaController

function MediaController (
)

Constructor

Class properties

ANIMATION_TIME

static private ANIMATION_TIME:Number = 250
(read)

Animation duration in ms

CLOSE_DELAY

static private CLOSE_DELAY:Number = 1000
(read)

Delay before closing open controller on rollout

CLOSED_HORIZONTAL_HEIGHT

static private CLOSED_HORIZONTAL_HEIGHT:Number = 25
(read)

The height of the closed control

CLOSED_VERTICAL_WIDTH

static private CLOSED_VERTICAL_WIDTH:Number = 25
(read)

The width of the closed vertical control

H_BORDER

static private H_BORDER:Number = 8
(read)

LOADBAR_HORIZONTAL_CLOSED_Y

static private LOADBAR_HORIZONTAL_CLOSED_Y:Number = 14
(read)

The y-coordinate of the loadbar when the controller is closed

LOADBAR_HORIZONTAL_OPEN_Y

static private LOADBAR_HORIZONTAL_OPEN_Y:Number = 24
(read)

The y-coordinate of the loadbar when the controller is open

LOADBAR_VERTICAL_CLOSED_X

static private LOADBAR_VERTICAL_CLOSED_X:Number = 14
(read)

The x-coordinate of the loadbar when the controller is closed

LOCALIZED_FILE

static private LOCALIZED_FILE:String = "streamingmediacontroller.xml"
(read)

The name of the XML file holding localized strings

MINIMUM_HORIZONTAL_OPEN_HEIGHT

static private MINIMUM_HORIZONTAL_OPEN_HEIGHT:Number = 63
(read)

The minimum height of the open control

MINIMUM_HORIZONTAL_WIDTH

static private MINIMUM_HORIZONTAL_WIDTH:Number = 202
(read)

The minimum width of the horizontal component

MINIMUM_VERTICAL_HEIGHT

static private MINIMUM_VERTICAL_HEIGHT:Number = 202
(read)

The minimum height of the vertical component

MINIMUM_VERTICAL_OPEN_WIDTH

static private MINIMUM_VERTICAL_OPEN_WIDTH:Number = 80
(read)

The minimum width of the open vertical control

MINIPLAYBAR_VERTICAL_CLOSED_X

static private MINIPLAYBAR_VERTICAL_CLOSED_X:Number = 8
(read)

The x-coordinate of the miniplaybar when the controller is closed

OPEN_DELAY

static private OPEN_DELAY:Number = 100
(read)

Delay before opening closed controller on rollover

symbolName

static symbolName:String = "MediaController"
(read)

symbolOwner

static symbolOwner:Object = mx.controls.MediaController
(read)

V_BORDER

static private V_BORDER:Number = 8
(read)

version

static version:String = "2.0.2.126"
(read)

Instance properties

_activePlayControl

private _activePlayControl:String
(read)

The initial active play control is either "play" or "pause"

_animating

private _animating:Boolean = false
(read)

Is animation active?

_animationOpen

private _animationOpen:Boolean
(read)

Animate open or closed?

_animationStart

private _animationStart:Number
(read)

Start time in ms since movie started

_backgroundStyle

private _backgroundStyle:String
(read)

Allowable values are "none" and "default"

_buttons

private _buttons:MovieClip
(read)

The control buttons

_chrome

private _chrome:Chrome
(read)

Chrome

_closeId

private _closeId:Number
(read)

The id of the interval used to close the controller.

_controllerPolicy

private _controllerPolicy:String
(read)

Indicates how the controller behaves wrt mouse interaction.
3 allowable settings:
on: always expanded
off: always contracted (must be expanded programmatically)
auto: initially contracted. expands when mouse rolls over,
contracts when mouse rolls off.

_deadPreview

private _deadPreview:MovieClip
(read)

_enabled

private _enabled:Boolean = true
(read)

Is this component enabled?

_horizontal

private _horizontal:Boolean
(read)

_isOpen

private _isOpen:Boolean
(read)

Is the clip open?

_isPlaying

private _isPlaying:Boolean
(read)

Is the control playing?

_lastProgressMediaType

private _lastProgressMediaType:String
(read)

The media type of the display component that most recently broadcast
a progress event that was received by this controller.
This is used to determine whether to disable the toEnd button.

_listenForPlayheadMoveEvent

private _listenForPlayheadMoveEvent:Boolean
(read)

Is the user listening for playhead move events?

_loadBar

private _loadBar:LoadBar
(read)

_loadPercent

private _loadPercent:Number
(read)

The last load completion percentage

_miniPlayBar

private _miniPlayBar:MiniPlayBar
(read)

_notAnimating

private _notAnimating:Boolean
(read)

True to ignore rollovers and not animate. This is used to suppress
animation when the mouse is over a full screen toggle control.

_openId

private _openId:Number
(read)

The id of the interval used to open the controller.

_openUpOrLeft

private _openUpOrLeft:Boolean
(read)

Move up or to the left when animating open.
Vertical orientation -> open left.
Horizontal orientation -> open up.

_playBar

private _playBar:PlayBar
(read)

_playPercent

private _playPercent:Number
(read)

The last play percentage

_playTime

private _playTime:Number
(read)

The last play time, in seconds

_priorMouseOver

private _priorMouseOver:Boolean
(read)

Was the mouse over the clip the last time we checked?

_priorPolicy

private _priorPolicy:String
(read)

The controllerPolicy prior to being disabled

_screenAccommodator

private _screenAccommodator:ScreenAccommodator
(read)

The screen accommodator automatically enables and disables the
component inside a screen.

_secondChrome

private _secondChrome:Chrome
(read)

Second chrome -- lets the controller animate the player's chrome

_secondChromeClosedHeight

private _secondChromeClosedHeight:Number
(read)

_secondChromeClosedWidth

private _secondChromeClosedWidth:Number
(read)

_secondChromeFixedEnd

private _secondChromeFixedEnd:Boolean
(read)

Animate it up or to the left

_secondChromeOpenHeight

private _secondChromeOpenHeight:Number
(read)

_secondChromeOpenWidth

private _secondChromeOpenWidth:Number
(read)

_strings

private _strings:Object
(read)

The localized strings

_volume

private _volume:Number
(read)

The last volume that the control was set to. Between 0 and 100.

_volumeControl

private _volumeControl:VolumeControl
(read)

activePlayControl

activePlayControl:String
(read,write)

The active play control must be either play or pause.
It must be writable so it can be set by the properties inspector.
It only pertains to the starting state of the component and should
*not* be written under normal circumstances.
Component metadata:
    Inspectable
    defaultValue:
    "pause"
    enumeration:
    "pause,play"

    backgroundStyle

    backgroundStyle:String
    (read,write)

    Should the component draw chrome?
    Component metadata:
      Inspectable
      defaultValue:
      "default"
      enumeration:
      "none,default"

      className

      className:String = "MediaController"
      (read)

      clipParameters

      clipParameters:Object = {}
      (read)

      controllerPolicy

      controllerPolicy:String
      (read,write)

      Indicates how the controller behaves wrt mouse interaction.
      3 allowable settings:
      on: always expanded
      off: always contracted (must be expanded programmatically)
      auto: initially contracted. expands when mouse rolls over,
      contracts when mouse rolls off.
      Component metadata:
        Inspectable
        defaultValue:
        "auto"
        enumeration:
        "auto,on,off"

        enabled

        enabled:Boolean
        (read,write)

        Enable or disable this component

        expanded

        expanded:Boolean
        (read)

        horizontal

        horizontal:Boolean
        (read,write)

        Component metadata:
          Inspectable
          defaultValue:
          true

          lastProgressMediaType

          lastProgressMediaType:String
          (read)

          playAtBeginning

          playAtBeginning:Boolean
          (read)

          Should a click on the play button start play at the beginning of
          the media?
          Must be public because the PlayPauseButton class needs to update it.

          playing

          playing:Boolean
          (read,write)

          Returns:
          • True if the control is playing; false if not.
          Component metadata:
            Bindable
            ChangeEvent

            playPercent

            playPercent:Number
            (read,write)

            playTime

            playTime:Number
            (read,write)

            volume

            volume:Number
            (read,write)

            Set the volume that is displayed in the controller.
            Returns:
            • The most recent volume setting
            Component metadata:
              Bindable
              ChangeEvent
              "volume"

              Instance methods

              addSecondChrome

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

              Add a second chrome to the control. This is used to allow the controller
              to animate the chrome of the player in auto mode.

              animate

              private function animate (
              ) : Void

              Animate the transition. This is called as an onEnterFrame function.

              animateBars

              private function animateBars (
              portion:Number) : Void

              Move and size the load and play bars during the opening and
              closing animations.

              animationDone

              private function animationDone (
              ) : Void

              associateDisplay

              function associateDisplay (
              d:MediaDisplay) : Void

              Associated this controller with a display. Set up the event listeners
              between the two.

              broadcastEvent

              function broadcastEvent (
              eventType:String, detailArg) : Void

              Broadcast an event.
              Parameters:
              eventType:
              The type of event (play, stop, pause, etc)
              detailArg:
              An additional parameter for the specific event type

              contract

              function contract (
              force:Boolean) : Void

              If policy is auto for this clip, contract it. Otherwise, do nothing.
              Unless forced.

              createDefaultStrings

              private function createDefaultStrings (
              ) : Void

              Create default localized strings to use (a) while loading occurs or
              (b) if loading fails.

              draw

              function draw (
              Void) : Void

              drawChrome

              private function drawChrome (
              wi:Number, he:Number) : Void

              Draw the chrome for the controller.
              Parameters:
              width :
              The width of the chrome. Optional. If not specified, then the
              appropriate standard open or closed width will be used.
              height:
              The height of the chrome. Optional. If not specified, then the
              appropriate standard open or closed height will be used.

              evaluateToEnd

              function evaluateToEnd (
              ) : Void

              Enable or disable the toEnd button, as appropriate.

              expand

              function expand (
              force:Boolean) : Void

              If policy is auto for this clip, expand the controller.
              Otherwise, do nothing. Unless forced.

              getClosedFrameName

              private function getClosedFrameName (
              ) : String

              getLoadBar

              function getLoadBar (

              getLoadPercent

              function getLoadPercent (
              ) : Number

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

              getLocalizedString

              function getLocalizedString (
              id:String) : String

              Parameters:
              The:
              id of the string to retrieve
              Returns:
              • The value of the string

              getMinimumClosedHeight

              function getMinimumClosedHeight (
              ) : Number

              getMinimumClosedWidth

              function getMinimumClosedWidth (
              ) : Number

              getMinimumOpenHeight

              function getMinimumOpenHeight (
              ) : Number

              getMinimumOpenWidth

              function getMinimumOpenWidth (
              ) : Number

              getOpenFrameName

              private function getOpenFrameName (
              ) : String

              handleChangeEvent

              private function handleChangeEvent (
              ev:Object) : Void

              Handle a change event. Position the playbar to show the
              the current play position.
              Save the data in the controller so the playbar can subsequently
              be initialized properly.

              handleCompleteEvent

              private function handleCompleteEvent (
              ev:Object) : Void

              Handle a complete event

              handleEvent

              function handleEvent (
              ev:Object) : Void

              Handle events for which the controller listens

              handleProgressEvent

              private function handleProgressEvent (
              ev:Object) : Void

              Handle a progress event. Position the load bar to show the percentage
              of the media that has loaded.

              handleScrubbingEvent

              private function handleScrubbingEvent (
              ev:Object) : Void

              Handle a scrubbing event

              handleUnrecognizedEvent

              private function handleUnrecognizedEvent (
              ev:Object) : Void

              Handle an unrecognized event

              init

              function init (
              Void) : Void

              Initialize the controller.

              initializeParameters

              private function initializeParameters (
              ) : Void

              Create default values for absent parameters

              isListeningForPlayheadMoveEvent

              function isListeningForPlayheadMoveEvent (
              ) : Boolean

              Returns:
              • True if the controller is listening for playhead move events.
                False if not.

              isNotAnimating

              function isNotAnimating (
              ) : Boolean

              isOpenUpOrLeft

              function isOpenUpOrLeft (
              ) : Boolean

              isPlaying

              function isPlaying (
              ) : Boolean

              isScrubbing

              function isScrubbing (
              ) : Boolean

              Is the user scrubbing the media?

              positionControlsHorizontal

              private function positionControlsHorizontal (
              ) : Void

              positionControlsVertical

              private function positionControlsVertical (
              ) : Void

              refreshBars

              function refreshBars (
              ) : Void

              removeSecondChrome

              function removeSecondChrome (
              ) : Void

              Remove the second chrome instance from the controller.

              setListeningForPlayheadMoveEvent

              function setListeningForPlayheadMoveEvent (
              listen:Boolean) : Void

              Returns:
              • True if the controller is listening for playhead move events.
                False if not.

              setNotAnimating

              function setNotAnimating (
              still:Boolean) : Void

              setOpenUpOrLeft

              function setOpenUpOrLeft (
              is:Boolean) : Void

              setPlaying

              function setPlaying (
              playFlag:Boolean) : Void

              setSize

              function setSize (
              w:Number, h:Number, noEvent:Boolean) : Void

              size the object
              #
              Parameters:
              w :
              width of the object
              #
              h :
              height of the object
              #
              noEvent:
              if true, doesn't broadcast "resize" event
              #

              sizeMainChrome

              private function sizeMainChrome (
              portion:Number) : Void

              Size the main chrome according to the portion parameter.
              Parameters:
              portion:
              A number between 0 and 1 (inclusive) indicating how far along
              the animation has progressed.

              sizeSecondChrome

              private function sizeSecondChrome (
              portion:Number) : Void

              Event handlers

              onMouseMove

              function onMouseMove (
              ) : Void

              Manually monitor mouse movement. It would be nice to use the
              onRollOver and onRollOut functions but those will prevent mouse
              events from reaching the contained clips. No good. Instead
              we manually track mouse movement.