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
- symbolName : String
- symbolOwner : Object
- version : String
- MINIMUM_HORIZONTAL_WIDTH : Number
- The minimum width of the horizontal component
- CLOSED_HORIZONTAL_HEIGHT : Number
- The height of the closed control
- MINIMUM_HORIZONTAL_OPEN_HEIGHT : Number
- The minimum height of the open control
- LOADBAR_HORIZONTAL_CLOSED_Y : Number
- The y-coordinate of the loadbar when the controller is closed
- LOADBAR_HORIZONTAL_OPEN_Y : Number
- The y-coordinate of the loadbar when the controller is open
- MINIMUM_VERTICAL_HEIGHT : Number
- The minimum height of the vertical component
- CLOSED_VERTICAL_WIDTH : Number
- The width of the closed vertical control
- MINIMUM_VERTICAL_OPEN_WIDTH : Number
- The minimum width of the open vertical control
- LOADBAR_VERTICAL_CLOSED_X : Number
- The x-coordinate of the loadbar when the controller is closed
- MINIPLAYBAR_VERTICAL_CLOSED_X : Number
- The x-coordinate of the miniplaybar when the controller is closed
- ANIMATION_TIME : Number
- Animation duration in ms
- CLOSE_DELAY : Number
- Delay before closing open controller on rollout
- OPEN_DELAY : Number
- Delay before opening closed controller on rollover
- LOCALIZED_FILE : String
- The name of the XML file holding localized strings
- H_BORDER : Number
- V_BORDER : Number
Class properties inherited from UIComponent
Class properties inherited from UIObject
Instance properties
- className : String
- clipParameters : Object
- _deadPreview : MovieClip
- _controllerPolicy : String
- Indicates how the controller behaves wrt mouse interaction.
- _horizontal : Boolean
- _buttons : MovieClip
- The control buttons
- _loadBar : LoadBar
- _playBar : PlayBar
- _miniPlayBar : MiniPlayBar
- _volumeControl : VolumeControl
- _chrome : Chrome
- Chrome
- _backgroundStyle : String
- Allowable values are "none" and "default"
- _isOpen : Boolean
- Is the clip open?
- _priorMouseOver : Boolean
- Was the mouse over the clip the last time we checked?
- _animationStart : Number
- Start time in ms since movie started
- _animationOpen : Boolean
- Animate open or closed?
- _closeId : Number
- The id of the interval used to close the controller.
- _openId : Number
- The id of the interval used to open the controller.
- _notAnimating : Boolean
- True to ignore rollovers and not animate.
- _animating : Boolean
- Is animation active?
- _listenForPlayheadMoveEvent : Boolean
- Is the user listening for playhead move events?
- _activePlayControl : String
- The initial active play control is either "play" or "pause"
- _isPlaying : Boolean
- Is the control playing?
- _volume : Number
- The last volume that the control was set to.
- _playPercent : Number
- The last play percentage
- _playTime : Number
- The last play time, in seconds
- _loadPercent : Number
- The last load completion percentage
- _strings : Object
- The localized strings
- _secondChrome : Chrome
- Second chrome -- lets the controller animate the player's chrome
- _secondChromeClosedHeight : Number
- _secondChromeOpenHeight : Number
- _secondChromeClosedWidth : Number
- _secondChromeOpenWidth : Number
- _secondChromeFixedEnd : Boolean
- Animate it up or to the left
- _openUpOrLeft : Boolean
- Move up or to the left when animating open.
- _enabled : Boolean
- Is this component enabled?
- _priorPolicy : String
- The controllerPolicy prior to being disabled
- playAtBeginning : Boolean
- Should a click on the play button start play at the beginning of
- _lastProgressMediaType : String
- The media type of the display component that most recently broadcast
- lastProgressMediaType : String
- _screenAccommodator : ScreenAccommodator
- The screen accommodator automatically enables and disables the
- expanded : Boolean
- controllerPolicy : String
- Indicates how the controller behaves wrt mouse interaction.
- horizontal : Boolean
- volume : Number
- Set the volume that is displayed in the controller.
- backgroundStyle : String
- Should the component draw chrome?
- activePlayControl : String
- The active play control must be either play or pause.
- playing : Boolean
- playTime : Number
- playPercent : Number
- enabled : Boolean
- Enable or disable this component
Instance properties inherited from UIComponent
Instance properties 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 tabEnabled textAlign textDecoration textIndent tfList top validateNow visible width x y
Class methods
Class methods inherited from UIObject
Instance methods
- init (Void) : Void
- Initialize the controller.
- initializeParameters : Void
- Create default values for absent parameters
- getOpenFrameName : String
- getClosedFrameName : String
- draw (Void) : Void
- positionControlsVertical : Void
- positionControlsHorizontal : Void
- drawChrome (wi:Number, he:Number) : Void
- Draw the chrome for the controller.
- addSecondChrome (theChrome:Chrome, closedHeight:Number, openHeight:Number, closedWidth:Number, openWidth:Number, fixedEnd:Boolean) : Void
- Add a second chrome to the control.
- removeSecondChrome : Void
- Remove the second chrome instance from the controller.
- expand (force:Boolean) : Void
- If policy is auto for this clip, expand the controller.
- contract (force:Boolean) : Void
- If policy is auto for this clip, contract it.
- animate : Void
- Animate the transition.
- animationDone : Void
- sizeMainChrome (portion:Number) : Void
- Size the main chrome according to the portion parameter.
- sizeSecondChrome (portion:Number) : Void
- animateBars (portion:Number) : Void
- Move and size the load and play bars during the opening and
- getLoadBar : LoadBar
- refreshBars : Void
- getLoadPercent : Number
- This function is only for the internal use of the the controller.
- getMinimumOpenHeight : Number
- getMinimumClosedHeight : Number
- getMinimumOpenWidth : Number
- getMinimumClosedWidth : Number
- broadcastEvent (eventType:String, detailArg) : Void
- Broadcast an event.
- handleEvent (ev:Object) : Void
- Handle events for which the controller listens
- isListeningForPlayheadMoveEvent : Boolean
- setListeningForPlayheadMoveEvent (listen:Boolean) : Void
- isNotAnimating : Boolean
- setNotAnimating (still:Boolean) : Void
- isPlaying : Boolean
- setPlaying (playFlag:Boolean) : Void
- handleChangeEvent (ev:Object) : Void
- Handle a change event.
- handleProgressEvent (ev:Object) : Void
- Handle a progress event.
- evaluateToEnd : Void
- Enable or disable the toEnd button, as appropriate.
- handleCompleteEvent (ev:Object) : Void
- Handle a complete event
- handleScrubbingEvent (ev:Object) : Void
- Handle a scrubbing event
- handleUnrecognizedEvent (ev:Object) : Void
- Handle an unrecognized event
- createDefaultStrings : Void
- Create default localized strings to use (a) while loading occurs or
- getLocalizedString (id:String) : String
- isOpenUpOrLeft : Boolean
- setOpenUpOrLeft (is:Boolean) : Void
- associateDisplay (d:MediaDisplay) : Void
- Associated this controller with a display.
- setSize (w:Number, h:Number, noEvent:Boolean) : Void
- size the object
- isScrubbing : Boolean
- Is the user scrubbing the media?
Instance methods inherited from UIObject
__getTextFormat _createChildren _getTextFormat cancelAllDoLaters constructObject createChildren createClassObject createEmptyObject createLabel createObject createSkin destroyObject doLater doLaterDispatcher draw drawRect getClassStyleDeclaration getMinHeight getMinWidth getSkinIDName getStyle getStyleName init initFromClipParameters invalidate invalidateStyle move redraw setColor setMinHeight setMinWidth setSize setSkin setVisible size
Event handlers
- onMouseMove : Void
- Manually monitor mouse movement.
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
_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.
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.
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
_loadPercent
private _loadPercent:Number
(read)
The last load completion percentage
_miniPlayBar
_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.
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.
Vertical orientation -> open left.
Horizontal orientation -> open up.
_playBar
_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
The screen accommodator automatically enables and disables the
component inside a screen.
component inside a screen.
_secondChrome
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
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.
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.
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.
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.
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.
closing animations.
animationDone
private function animationDone (
) : Void
associateDisplay
Associated this controller with a display. Set up the event listeners
between the two.
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.
Unless forced.
createDefaultStrings
private function createDefaultStrings (
) : Void
Create default localized strings to use (a) while loading occurs or
(b) if loading fails.
(b) if loading fails.
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.
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.
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.
Otherwise, do nothing. Unless forced.
getClosedFrameName
private function getClosedFrameName (
) : String
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.
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.
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.
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
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
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.
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.
onRollOver and onRollOut functions but those will prevent mouse
events from reaching the contained clips. No good. Instead
we manually track mouse movement.