Media class

Inheritance MovieClip > UIObject class > UIComponent class > Media

ActionScript Class Names mx.controls.MediaController, mx.controls.MediaDisplay, mx.controls.MediaPlayback

Each component class has a version property, which is a class property. Class properties are available only for the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code:

trace(mx.controls.MediaPlayback.version);

NOTE

 

The code trace(myMediaInstance.version); returns undefined.

Method summary for the Media class

The following table lists methods of the Media class.

Method

Components

Description

Media.addCuePoint()

MediaDisplay, MediaPlayback

Adds a cue point object to the component instance.

Media.associateController()

MediaDisplay

Associates a MediaDisplay instance with a MediaController instance.

Media.associateDisplay()

MediaController

Associates a MediaController instance with a MediaDisplay instance.

Media.displayFull()

MediaPlayback

Converts the component instance to full-screen playback mode.

Media.displayNormal()

MediaPlayback

Converts the component instance back to its original screen size.

Media.getCuePoint()

MediaDisplay, MediaPlayback

Returns a cue point object.

Media.pause()

MediaDisplay, MediaPlayback

Pauses the playhead at its current location in the media timeline.

Media.play()

MediaDisplay, MediaPlayback

Plays the media associated with the component instance at a given starting point.

Media.removeAllCuePoints()

MediaDisplay, MediaPlayback

Deletes all cue point objects associated with a given component instance.

Media.removeCuePoint()

MediaDisplay, MediaPlayback

Deletes a specified cue point associated with a given component instance.

Media.setMedia()

MediaDisplay, MediaPlayback

Sets the media type and path to the specified media type.

Media.stop()

MediaDisplay, MediaPlayback

Stops the playhead and moves it to position 0, which is the beginning of the media.

Property summary for the Media class

The following table lists properties of the Media class.

Property

Components

Description

Media.activePlayControl

MediaController

Determines the component state when loaded at runtime.

Media.aspectRatio

MediaDisplay, MediaPlayback

Determines if the component instance maintains its video aspect ratio.

Media.autoPlay

MediaDisplay, MediaPlayback

Determines if the component instance immediately starts to buffer and play.

Media.autoSize

MediaDisplay, MediaPlayback

Determines the size of the media-viewing portion of the MediaDisplay or MediaPlayback component.

Media.backgroundStyle

MediaController

Determines if the component instance draws its chrome background.

Media.bytesLoaded

MediaDisplay, MediaPlayback

Read-only; the number of bytes loaded that are available for playing.

Media.bytesTotal

MediaDisplay, MediaPlayback

The number of bytes to be loaded into the component instance.

Media.contentPath

MediaDisplay, MediaPlayback

A string that holds the relative path and filename of the media to be streamed and played.

Media.controllerPolicy

MediaController, MediaPlayback

Determines whether the controller is hidden when instantiated and only appears when the user moves the mouse over the controller's collapsed state.

Media.controlPlacement

MediaPlayback

Determines where the component's controls are positioned.

Media.cuePoints

MediaDisplay, MediaPlayback

An array of cue point objects that have been assigned to a given component instance.

Media.horizontal

MediaController

Determines the orientation of the component instance.

Media.mediaType

MediaDisplay, MediaPlayback

Determines the type of media to be played.

Media.playheadTime

MediaDisplay, MediaPlayback

Holds the current position of the playhead (in seconds) for the media timeline that is playing.

Media.playing

MediaDisplay, MediaPlayback, MediaController

For MediaDisplay and MediaPlayback, this property is read-only and returns a Boolean value to indicate whether a given component instance is playing media. For MediaController, this property is read/write and controls the image (playing or paused) displayed on the Play/Pause button of the controller.

Media.preferredHeight

MediaDisplay, MediaPlayback

The default value of the height of a FLV file.

Media.preferredWidth

MediaDisplay, MediaPlayback

The default value of the width of a FLV file.

Media.totalTime

MediaDisplay, MediaPlayback

An integer that indicates the total length of the media, in seconds.

Media.volume

MediaDisplay, MediaPlayback

An integer from 0 (minimum) to 100 (maximum) that represents the volume level.

Event summary for the Media class

The following table lists events of the Media class.

Event

Components

Description

Media.change

MediaDisplay, MediaPlayback

Broadcast continuously while media is playing.

Media.click

MediaController, MediaPlayback

Broadcast when the user clicks the Play/Pause button.

Media.complete

MediaDisplay, MediaPlayback

Notification that the playhead has reached the end of the media.

Media.cuePoint

MediaDisplay, MediaPlayback

Notification that the playhead has reached a given cue point.

Media.playheadChange

MediaController, MediaPlayback

Broadcast by the component instance when a user moves the playback slider or clicks the Go to Beginning or Go to End button.

Media.progress

MediaDisplay, MediaPlayback

Generated continuously until the media has downloaded completely.

Media.scrubbing

MediaController,

MediaPlayback

Generated when the playhead is dragged.

Media.volume

MediaController, MediaPlayback

Broadcast when the user adjusts the volume.


Flash CS3