From 4431b43e45744e07c7d16bfd0749a4b0816debf8 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Fri, 22 Jun 2018 09:45:23 -0400 Subject: [PATCH] A few leftover loadSound that werent updated --- src/serialization/sb2.js | 2 +- src/sprites/sprite.js | 2 +- src/virtual-machine.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 9ca378d90..ffde8220a 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -420,7 +420,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip) // followed by the file ext const assetFileName = `${soundSource.soundID}.${ext}`; soundPromises.push(deserializeSound(sound, runtime, zip, assetFileName) - .then(() => loadSound(sound, runtime))); + .then(() => loadSound(sound, runtime, sprite))); } } diff --git a/src/sprites/sprite.js b/src/sprites/sprite.js index c7c35c9e0..bc61960a0 100644 --- a/src/sprites/sprite.js +++ b/src/sprites/sprite.js @@ -155,7 +155,7 @@ class Sprite { newSprite.sounds = this.sounds.map(sound => { const newSound = Object.assign({}, sound); const soundAsset = this.runtime.storage.get(sound.assetId); - assetPromises.push(loadSoundFromAsset(newSound, soundAsset, this.runtime)); + assetPromises.push(loadSoundFromAsset(newSound, soundAsset, this.runtime, this)); return newSound; }); diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 9e93b79d2..57ae97e76 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -495,7 +495,7 @@ class VirtualMachine extends EventEmitter { duplicateSound (soundIndex) { const originalSound = this.editingTarget.getSounds()[soundIndex]; const clone = Object.assign({}, originalSound); - return loadSound(clone, this.runtime).then(() => { + return loadSound(clone, this.runtime, this.editingTarget.sprite).then(() => { this.editingTarget.addSound(clone, soundIndex + 1); this.emitTargetsUpdate(); }); @@ -966,8 +966,8 @@ class VirtualMachine extends EventEmitter { shareSoundToTarget (soundIndex, targetId) { const originalSound = this.editingTarget.getSounds()[soundIndex]; const clone = Object.assign({}, originalSound); - return loadSound(clone, this.runtime).then(() => { - const target = this.runtime.getTargetById(targetId); + const target = this.runtime.getTargetById(targetId); + return loadSound(clone, this.runtime, target.sprite).then(() => { if (target) { target.addSound(clone); this.emitTargetsUpdate();