tolmark
tolmark

Reputation: 1816

Is there a `unload` item for Createjs' preloadjs/soundjs

Once you've loaded a mp3 into a sound object via createjs, how dow you destroy & clear it from memory?

Upvotes: 0

Views: 577

Answers (1)

Lanny
Lanny

Reputation: 11294

There are static methods for this:

  1. removeSound: Remove stored references to sounds by source
  2. removeSounds: Remove multiple sound src's
  3. removeAllSounds: Wipe references to sounds

Examples

 createjs.Sound.removeSound("myID");
 createjs.Sound.removeSound("myAudioBasePath/mySound.ogg");
 createjs.Sound.removeSound("myPath/myOtherSound.mp3", "myBasePath/");
 createjs.Sound.removeSound({mp3:"musicNoExtension", ogg:"music.ogg"}, "myBasePath/");

Check out the docs for more info.

This is not a super common use-case, so if you run into issue, please feel free to open an issue on GitHub

Upvotes: 1

Related Questions