playFile()
453
playFile()
Usage
-- Lingo syntax
soundChannelObjRef
.playFile(
stringFilePath
)
// JavaScript syntax
soundChannelObjRef
.playFile(
stringFilePath
);
Description
Sound Channel method; plays the AIFF, SWA, AU, or WAV sound in a sound channel.
For the sound to be played properly, the correct MIX Xtra must be available to the movie, usually
in the Xtras folder of the application.
When the sound file is in a different folder than the movie,
stringFilePath
must specify the full
path to the file.
To play sounds obtained from a URL, it’s usually a good idea to use
downloadNetThing()
or
preloadNetThing()
to download the file to a local disk first. This approach can minimize
problems that may occur while the file is downloading.
The
playFile()
method streams files from disk rather than playing them from RAM. As
a result, using
playFile()
when playing digital video or when loading cast members into
memory can cause conflicts when the computer tries to read the disk in two places at once.
Parameters
stringFilePath
Required. A string that specifies the name of the file to play. When the sound
file is in a different folder than the currently playing movie,
stringFilePath
must also specify
the full path to the file.
Example
This statement plays the file named Thunder in channel 1:
-- Lingo syntax
sound(1).playFile("Thunder.wav")
// JavaScript syntax
sound(1).playFile("Thunder.wav");
This statement plays the file named Thunder in channel 3:
-- Lingo syntax
sound(3).playFile(_movie.path & "Thunder.wav")
// JavaScript syntax
sound(3).playFile(_movie.path + "Thunder.wav");
See also
play() (Sound Channel)
,
Sound Channel
,
stop() (Sound Channel)
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...