User Guide

Media components (Flash Professional only) 535
Media.setMedia()
Applies to
MediaDisplay, MediaPlayback
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
myMedia.setMedia(contentPath [, mediaType])
Parameters
contentPath
A string that indicates the URL of the media to be played. The default value is
undefined.
mediaType A string used to set the media type to either FLV or MP3. This parameter
is optional. The default value is FLV.
Returns
Nothing.
Description
Method; sets the media type and path to the specified media type using a URL parameter.
This method provides the recommended way of setting the content path and media type for the
MediaPlayback and MediaDisplay components. The
Media.contentPath property can also be
used to set the content path, but does not allow you to set the media type.
If you are working only with FLV files, you do not need to specify a
mediaType parameter. If you
are working exclusively with MP3 files, you must set the
mediaType parameter to MP3 once. If
you are switching back and forth between FLV and MP3 files, you must change the media type
each time in your
setMedia() call. If you attempt to play an MP3 file without explicitly setting
the media type to MP3, the file will not play.
Example
The following code provides new media for a component instance to play.
myMedia.setMedia("http://www.RogerMoore.com/moonraker.flv", "FLV");
Media.stop()
Applies to
MediaDisplay, MediaPlayback
Availability
Flash Player 7.