Class Sound
Extends
SceneContent.
Loads some audio or sound into the Scene. This implementation uses the
HTML 5 audio tag and therefore requires a compatible browser.
Defined in: Sound.js.
var sound1 = Audio({ url: "http://www.tellurianring.com/sounds/laugh.ogg" }); sound1.play();
Relative URL's work as well: var sound2 = Audio({ url: "./sounds/ohhh.ogg" }); sound2.play();
Constructor Attributes | Constructor Name and Description |
---|---|
Sound(_details)
|
- Fields borrowed from class SceneContent:
- details
Method Attributes | Method Name and Description |
---|---|
doLoad()
Executed when the audio is actually loaded.
|
|
pause()
Pauses the sound.
|
|
play()
Sets the volume to the initial volume, and starts the sound.
|
|
setLoop(_loop)
Sets the looping of this Sound.
|
|
setVolume(_volume)
Sets the volume on this Sound.
|
|
stop()
Stops the sound.
|
- Methods borrowed from class SceneContent:
- draw, extend, getBounds, getName, getParent, getScene, getStage, isActive, isVisible, load, loadBase, moveBy, moveTo, setActive, setSize, setVisible, update, updateBase
Class Detail
Sound(_details)
- Parameters:
- {Object} _details
- A JSON object with the following properties:
Property Required Default loop no false start no false url yes volume no 1
Method Detail
doLoad()
Executed when the audio is actually loaded.
pause()
Pauses the sound.
play()
Sets the volume to the initial volume, and starts the sound.
setLoop(_loop)
Sets the looping of this Sound.
- Parameters:
- {Boolean} _loop
- Turns looping on for this sound - true or false.
setVolume(_volume)
Sets the volume on this Sound.
- Parameters:
- {Decimal} _volume
- Volume of sound between 0.0 and 1.0
stop()
Stops the sound. This implementation pauses the sound and resets it.