addSound (soundObject, optTargetId) {
        this.emit('addSound*', {name: soundObject.name});
        const target = optTargetId ? this.runtime.getTargetById(optTargetId) :
            this.editingTarget;
        if (target) {
            return loadSound(soundObject, this.runtime, target.sprite.soundBank).then(() => {
                target.addSound(soundObject);
                this.emitTargetsUpdate();
            });
        }
        // If the target cannot be found by id, return a rejected promise
        return new Promise.reject();
    }
/**
     * Add a sound to the current editing target.
     * @param {!object} soundObject Object representing the costume.
     * @param {string} optTargetId - the id of the target to add to, if not the editing target.
     * @returns {?Promise} - a promise that resolves when the sound has been decoded and added
     */
Add a sound to the current editing target.
@param {!object} soundObject Object representing the costume.
@param {string} optTargetId - the id of the target to add to, if not the editing target.
@returns {?Promise} - a promise that resolves when the sound has been decoded and added
Add a sound to the current editing target . @param { !object } soundObject Object representing the costume . @param { string } optTargetId - the id of the target to add to if not the editing target . @returns { ?Promise } - a promise that resolves when the sound has been decoded and added
addSound (soundObject, optTargetId) {
        this.emit('addSound*', {name: soundObject.name});
        const target = optTargetId ? this.runtime.getTargetById(optTargetId) :
            this.editingTarget;
        if (target) {
            return loadSound(soundObject, this.runtime, target.sprite.soundBank).then(() => {
                target.addSound(soundObject);
                this.emitTargetsUpdate();
            });
        }
        return new Promise.reject();
    }
addSound ( soundObject , optTargetId ) { this . emit ( 'addSound*' , { name : soundObject . name } ) ; const target = optTargetId ? this . runtime . getTargetById ( optTargetId ) : this . editingTarget ; if ( target ) { return loadSound ( soundObject , this . runtime , target . sprite . soundBank ) . then ( ( ) => { target . addSound ( soundObject ) ; this . emitTargetsUpdate ( ) ; } ) ; } return new Promise . reject ( ) ; }
Add a sound to the current editing target.
Add a sound to the current editing target .
// If the target cannot be found by id, return a rejected promise