mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
add get sound index by name
This commit is contained in:
parent
f2793a1d59
commit
f90807e8a4
1 changed files with 14 additions and 0 deletions
|
@ -381,6 +381,20 @@ RenderedTarget.prototype.getCostumeIndexByName = function (costumeName) {
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a sound index of this rendered target, by name of the sound.
|
||||||
|
* @param {?string} soundName Name of a sound.
|
||||||
|
* @return {number} Index of the named sound, or -1 if not present.
|
||||||
|
*/
|
||||||
|
RenderedTarget.prototype.getSoundIndexByName = function (soundName) {
|
||||||
|
for (var i = 0; i < this.sprite.sounds.length; i++) {
|
||||||
|
if (this.sprite.sounds[i].name == soundName) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a costume of this rendered target by id.
|
* Get a costume of this rendered target by id.
|
||||||
* @return {object} current costume
|
* @return {object} current costume
|
||||||
|
|
Loading…
Reference in a new issue