Class mx.controls.MediaController

MovieClip
   +--mx.core.UIObject
      +--mx.core.UIComponent
         +--mx.controls.MediaController

Description

MediaController contains the playback controls for controlling streaming media files.

Field Index

_activePlayControl, _animating, _animationOpen, _animationStart, _backgroundStyle, _buttons, _chrome, _closeId, _controllerPolicy, _deadPreview, _enabled, _horizontal, _isOpen, _isPlaying, _lastProgressMediaType, _listenForPlayheadMoveEvent, _loadBar, _loadPercent, _miniPlayBar, _notAnimating, _openId, _openUpOrLeft, _playBar, _playPercent, _playTime, _priorMouseOver, _priorPolicy, _screenAccommodator, _secondChrome, _secondChromeClosedHeight, _secondChromeClosedWidth, _secondChromeFixedEnd, _secondChromeOpenHeight, _secondChromeOpenWidth, _strings, _volume, _volumeControl, activePlayControl, ANIMATION_TIME, backgroundStyle, className, clipParameters, CLOSE_DELAY, CLOSED_HORIZONTAL_HEIGHT, CLOSED_VERTICAL_WIDTH, controllerPolicy, enabled, expanded, H_BORDER, horizontal, lastProgressMediaType, LOADBAR_HORIZONTAL_CLOSED_Y, LOADBAR_HORIZONTAL_OPEN_Y, LOADBAR_VERTICAL_CLOSED_X, LOCALIZED_FILE, MINIMUM_HORIZONTAL_OPEN_HEIGHT, MINIMUM_HORIZONTAL_WIDTH, MINIMUM_VERTICAL_HEIGHT, MINIMUM_VERTICAL_OPEN_WIDTH, MINIPLAYBAR_VERTICAL_CLOSED_X, OPEN_DELAY, playAtBeginning, playing, playPercent, playTime, symbolName, symbolOwner, V_BORDER, volume
Inherited from UIComponent
clipParameters, drawFocus, enabled, focusEnabled, focusManager, focusTextField, groupName, height, kStretch, mergedClipParameters, origBorderStyles, origBorderValues, popUp, symbolName, symbolOwner, tabEnabled, tabIndex, width
Inherited from UIObject
__height, __onUnload, __width, _color, _endInit, _id, _maxHeight, _maxWidth, _minHeight, _minWidth, _preferredHeight, _preferredWidth, _tf, _topmost, addEventListener, bottom, buildDepthTable, changeColorStyleInChildren, changeTextStyleInChildren, childrenCreated, className, clipParameters, color, createAccessibilityImplementation, createChildAtDepth, createClassChildAtDepth, createEvent, dispatchEvent, embedFonts, findNextAvailableDepth, fontFamily, fontSize, fontStyle, fontWeight, handleEvent, height, idNames, ignoreClassStyleDeclaration, initProperties, invalidateFlag, left, lineColor, lineWidth, marginLeft, marginRight, methodTable, minHeight, minWidth, notifyStyleChangeInChildren, removeEventListener, right, scaleX, scaleY, setStyle, stylecache, styleName, symbolName, symbolOwner, tabEnabled, textAlign, textColorList, textDecoration, textIndent, tfList, top, validateNow, visible, width, x, y
Inherited from MovieClip
_alpha, _currentframe, _droptarget, _focusrect, _framesloaded, _height, _lockroot, _name, _parent, _quality, _rotation, _soundbuftime, _target, _totalframes, _url, _visible, _width, _x, _xmouse, _xscale, _y, _ymouse, _yscale, enabled, focusEnabled, hitArea, tabChildren, tabEnabled, tabIndex, tooltipText, trackAsMenu, useHandCursor

Method Index

new MediaController()

addSecondChrome(), animate(), animateBars(), animationDone(), associateDisplay(), broadcastEvent(), contract(), createDefaultStrings(), draw(), drawChrome(), evaluateToEnd(), expand(), getClosedFrameName(), getLoadBar(), getLoadPercent(), getLocalizedString(), getMinimumClosedHeight(), getMinimumClosedWidth(), getMinimumOpenHeight(), getMinimumOpenWidth(), getOpenFrameName(), handleChangeEvent(), handleCompleteEvent(), handleEvent(), handleProgressEvent(), handleScrubbingEvent(), handleUnrecognizedEvent(), init(), initializeParameters(), isListeningForPlayheadMoveEvent(), isNotAnimating(), isOpenUpOrLeft(), isPlaying(), isScrubbing(), onMouseMove(), positionControlsHorizontal(), positionControlsVertical(), refreshBars(), removeSecondChrome(), setListeningForPlayheadMoveEvent(), setNotAnimating(), setOpenUpOrLeft(), setPlaying(), setSize(), sizeMainChrome(), sizeSecondChrome()
Inherited from UIComponent
dispatchValueChangedEvent(), enabledChanged(), findFocusFromObject(), findFocusInChildren(), getFocus(), getFocusManager(), isParent(), onKillFocus(), onSetFocus(), pressFocus(), releaseFocus(), setEnabled(), setFocus(), setVisible(), size()
Inherited from UIObject
__getTextFormat(), _createChildren(), _getTextFormat(), cancelAllDoLaters(), constructObject(), createChildren(), createClassObject(), createEmptyObject(), createLabel(), createObject(), createSkin(), destroyObject(), doLater(), doLaterDispatcher(), drawRect(), getClassStyleDeclaration(), getMinHeight(), getMinWidth(), getSkinIDName(), getStyle(), getStyleName(), initFromClipParameters(), invalidate(), invalidateStyle(), mergeClipParameters(), move(), redraw(), setColor(), setMinHeight(), setMinWidth(), setSkin()
Inherited from MovieClip
attachAudio(), attachMovie(), beginFill(), beginGradientFill(), clear(), createEmptyMovieClip(), createTextField(), curveTo(), duplicateMovieClip(), endFill(), getBounds(), getBytesLoaded(), getBytesTotal(), getDepth(), getInstanceAtDepth(), getNextHighestDepth(), getSWFVersion(), getTextSnapshot(), getURL(), globalToLocal(), gotoAndPlay(), gotoAndStop(), hitTest(), lineStyle(), lineTo(), loadMovie(), loadVariables(), localToGlobal(), moveTo(), nextFrame(), onData(), onDragOut(), onDragOver(), onEnterFrame(), onKeyDown(), onKeyUp(), onLoad(), onMouseDown(), onMouseUp(), onPress(), onRelease(), onReleaseOutside(), onRollOut(), onRollOver(), onUnload(), play(), prevFrame(), removeMovieClip(), setMask(), startDrag(), stop(), stopDrag(), swapDepths(), unloadMovie(), valueOf()

Constructor Detail

MediaController

public function MediaController()
Constructor

Field Detail

symbolName

static symbolName:String

symbolOwner

static symbolOwner:Object

className

className:String

clipParameters

clipParameters:Object

MINIMUM_HORIZONTAL_WIDTH

static private MINIMUM_HORIZONTAL_WIDTH:Number

CLOSED_HORIZONTAL_HEIGHT

static private CLOSED_HORIZONTAL_HEIGHT:Number

MINIMUM_HORIZONTAL_OPEN_HEIGHT

static private MINIMUM_HORIZONTAL_OPEN_HEIGHT:Number

LOADBAR_HORIZONTAL_CLOSED_Y

static private LOADBAR_HORIZONTAL_CLOSED_Y:Number

LOADBAR_HORIZONTAL_OPEN_Y

static private LOADBAR_HORIZONTAL_OPEN_Y:Number

MINIMUM_VERTICAL_HEIGHT

static private MINIMUM_VERTICAL_HEIGHT:Number

CLOSED_VERTICAL_WIDTH

static private CLOSED_VERTICAL_WIDTH:Number

MINIMUM_VERTICAL_OPEN_WIDTH

static private MINIMUM_VERTICAL_OPEN_WIDTH:Number

LOADBAR_VERTICAL_CLOSED_X

static private LOADBAR_VERTICAL_CLOSED_X:Number

MINIPLAYBAR_VERTICAL_CLOSED_X

static private MINIPLAYBAR_VERTICAL_CLOSED_X:Number

ANIMATION_TIME

static private ANIMATION_TIME:Number

CLOSE_DELAY

static private CLOSE_DELAY:Number

OPEN_DELAY

static private OPEN_DELAY:Number

LOCALIZED_FILE

static private LOCALIZED_FILE:String

H_BORDER

static private H_BORDER:Number

V_BORDER

static private V_BORDER:Number

_deadPreview

private _deadPreview:MovieClip

_controllerPolicy

private _controllerPolicy:String

_horizontal

private _horizontal:Boolean

_buttons

private _buttons:MovieClip

_loadBar

private _loadBar:LoadBar

_playBar

private _playBar:PlayBar

_miniPlayBar

private _miniPlayBar:MiniPlayBar

_volumeControl

private _volumeControl:VolumeControl

_chrome

private _chrome:Chrome

_backgroundStyle

private _backgroundStyle:String

_isOpen

private _isOpen:Boolean

_priorMouseOver

private _priorMouseOver:Boolean

_animationStart

private _animationStart:Number

_animationOpen

private _animationOpen:Boolean

_closeId

private _closeId:Number

_openId

private _openId:Number

_notAnimating

private _notAnimating:Boolean

_animating

private _animating:Boolean

_listenForPlayheadMoveEvent

private _listenForPlayheadMoveEvent:Boolean

_activePlayControl

private _activePlayControl:String

_isPlaying

private _isPlaying:Boolean

_volume

private _volume:Number

_playPercent

private _playPercent:Number

_playTime

private _playTime:Number

_loadPercent

private _loadPercent:Number

_strings

private _strings:Object

_secondChrome

private _secondChrome:Chrome

_secondChromeClosedHeight

private _secondChromeClosedHeight:Number

_secondChromeOpenHeight

private _secondChromeOpenHeight:Number

_secondChromeClosedWidth

private _secondChromeClosedWidth:Number

_secondChromeOpenWidth

private _secondChromeOpenWidth:Number

_secondChromeFixedEnd

private _secondChromeFixedEnd:Boolean

_openUpOrLeft

private _openUpOrLeft:Boolean

_enabled

private _enabled:Boolean

_priorPolicy

private _priorPolicy:String

playAtBeginning

public playAtBeginning:Boolean

_lastProgressMediaType

private _lastProgressMediaType:String

lastProgressMediaType

public lastProgressMediaType:String [Read Only]

_screenAccommodator

private _screenAccommodator:ScreenAccommodator

expanded

public expanded:Boolean [Read Only]

controllerPolicy

public controllerPolicy:String
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.

horizontal

public horizontal:Boolean

volume

public volume:Number

backgroundStyle

public backgroundStyle:String
Should the component draw chrome?

activePlayControl

public activePlayControl:String
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.

playing

public playing:Boolean

playTime

public playTime:Number

playPercent

public playPercent:Number

enabled

public enabled:Boolean

Method Detail

init

function init(Void):Void
Initialize the controller.

initializeParameters

private function initializeParameters():Void
Create default values for absent parameters

getOpenFrameName

private function getOpenFrameName():
String

getClosedFrameName

private function getClosedFrameName():
String

draw

function draw(Void):Void

positionControlsVertical

private function positionControlsVertical():Void

positionControlsHorizontal

private function positionControlsHorizontal():Void

drawChrome

private function drawChrome(wi:
Number, he:Number):Void
Draw the chrome for the controller.
Parameters

addSecondChrome

public 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.

removeSecondChrome

public function removeSecondChrome():Void
Remove the second chrome instance from the controller.

onMouseMove

public 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.

expand

public function expand(force:
Boolean):Void
If policy is auto for this clip, expand the controller. Otherwise, do nothing. Unless forced.

contract

public function contract(force:
Boolean):Void
If policy is auto for this clip, contract it. Otherwise, do nothing. Unless forced.

animate

private function animate():Void
Animate the transition. This is called as an onEnterFrame function.

animationDone

private function animationDone():Void

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

animateBars

private function animateBars(portion:
Number):Void
Move and size the load and play bars during the opening and closing animations.

getLoadBar

public function getLoadBar():
LoadBar

refreshBars

public function refreshBars():Void

getLoadPercent

public function getLoadPercent():
Number
This function is only for the internal use of the the controller. It is public so that subclips can access it.

getMinimumOpenHeight

public function getMinimumOpenHeight():
Number

getMinimumClosedHeight

public function getMinimumClosedHeight():
Number

getMinimumOpenWidth

public function getMinimumOpenWidth():
Number

getMinimumClosedWidth

public function getMinimumClosedWidth():
Number

broadcastEvent

public 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

handleEvent

public function handleEvent(ev:
Object):Void
Handle events for which the controller listens

isListeningForPlayheadMoveEvent

public function isListeningForPlayheadMoveEvent():
Boolean
Return
True if the controller is listening for playhead move events. False if not.

setListeningForPlayheadMoveEvent

public function setListeningForPlayheadMoveEvent(listen:
Boolean):Void
Return
True if the controller is listening for playhead move events. False if not.

isNotAnimating

public function isNotAnimating():
Boolean

setNotAnimating

public function setNotAnimating(still:
Boolean):Void

isPlaying

public function isPlaying():
Boolean

setPlaying

public function setPlaying(playFlag:
Boolean):Void

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.

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.

evaluateToEnd

public function evaluateToEnd():Void
Enable or disable the toEnd button, as appropriate.

handleCompleteEvent

private function handleCompleteEvent(ev:
Object):Void
Handle a complete event

handleScrubbingEvent

private function handleScrubbingEvent(ev:
Object):Void
Handle a scrubbing event

handleUnrecognizedEvent

private function handleUnrecognizedEvent(ev:
Object):Void
Handle an unrecognized event

createDefaultStrings

private function createDefaultStrings():Void
Create default localized strings to use (a) while loading occurs or (b) if loading fails.

getLocalizedString

public function getLocalizedString(id:
String):String
Parameters
Return
The value of the string

isOpenUpOrLeft

public function isOpenUpOrLeft():
Boolean

setOpenUpOrLeft

public function setOpenUpOrLeft(is:
Boolean):Void

associateDisplay

public function associateDisplay(d:
MediaDisplay):Void
Associated this controller with a display. Set up the event listeners between the two.

setSize

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

isScrubbing

public function isScrubbing():
Boolean
Is the user scrubbing the media?