diff options
| author | Gubolin <gubolin@fantasymail.de> | 2014-08-02 09:54:51 +0200 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2014-08-02 09:54:51 +0200 |
| commit | a15885abf4965ecc6edf83348300f2885bacc2f2 (patch) | |
| tree | bdc75400fbe5c7e27a8f75d396f539d27ec085a7 /objects.js | |
| parent | 450fd058270196385eb0d1ba584318291f110a1b (diff) | |
| download | snap-a15885abf4965ecc6edf83348300f2885bacc2f2.tar.gz snap-a15885abf4965ecc6edf83348300f2885bacc2f2.zip | |
change volume of active sounds
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -2617,18 +2617,17 @@ SpriteMorph.prototype.playSound = function (name) { } }; -SpriteMorph.prototype.doSetVolume = function(val) { +SpriteMorph.prototype.doSetVolume = function (val) { var stage = this.parentThatIsA(StageMorph); stage.volume = val; - stage.sounds.asArray().forEach(function (snd) { - if (snd.audio !== undefined) { - snd.audio.volume = Math.min(Math.max(0, stage.volume), 100) / 100; - } + + stage.activeSounds.forEach(function (snd) { + snd.volume = Math.min(Math.max(0, stage.volume), 100) / 100; // 'audio' objects }); }; -SpriteMorph.prototype.reportVolume = function() { +SpriteMorph.prototype.reportVolume = function () { var stage = this.parentThatIsA(StageMorph); return stage.volume; } |
