Return a promise to indicate when a costume has loaded.
Parallels the way the `addSound` method works. Needed to enable selecting new assets automatically from GUI.
This commit is contained in:
1 parent
ba1f217004
commit
cbebc28307
1 file changed
+2
-1
@@ -314,9 +314,10 @@ class VirtualMachine extends EventEmitter {
|
||||
* @property {number} rotationCenterX - the X component of the costume's origin.
|
||||
* @property {number} rotationCenterY - the Y component of the costume's origin.
|
||||
* @property {number} [bitmapResolution] - the resolution scale for a bitmap costume.
|
||||
* @returns {?Promise} - a promise that resolves when the costume has been added
|
||||
*/
|
||||
addCostume (md5ext, costumeObject) {
|
||||
loadCostume(md5ext, costumeObject, this.runtime).then(() => {
|
||||
return loadCostume(md5ext, costumeObject, this.runtime).then(() => {
|
||||
this.editingTarget.addCostume(costumeObject);
|
||||
this.editingTarget.setCostume(
|
||||
this.editingTarget.sprite.costumes.length - 1
|
||||
|
||||
Reference in new issue
Block a user