mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-07 20:08:54 -04:00
onStopAll function for stop button
This commit is contained in:
parent
1e5555e96d
commit
6dadaba117
2 changed files with 16 additions and 0 deletions
src
|
@ -429,6 +429,7 @@ Runtime.prototype.stopAll = function () {
|
|||
// Dispose all clones.
|
||||
var newTargets = [];
|
||||
for (var i = 0; i < this.targets.length; i++) {
|
||||
this.targets[i].onStopAll();
|
||||
if (this.targets[i].hasOwnProperty('isOriginal') &&
|
||||
!this.targets[i].isOriginal) {
|
||||
this.targets[i].dispose();
|
||||
|
|
|
@ -435,6 +435,21 @@ Clone.prototype.makeClone = function () {
|
|||
*/
|
||||
Clone.prototype.onGreenFlag = function () {
|
||||
this.clearEffects();
|
||||
if (this.audioEngine) {
|
||||
this.audioEngine.stopAllSounds();
|
||||
this.audioEngine.clearEffects();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when the project receives a "stop all"
|
||||
* Stop all sounds
|
||||
*/
|
||||
Clone.prototype.onStopAll = function () {
|
||||
if (this.audioEngine) {
|
||||
this.audioEngine.stopAllSounds();
|
||||
this.audioEngine.clearEffects();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue