DOWNLOAD Soundfiles? -HELP

megagewinnspiel

  • Posts: 396
Hey guys,

does someone here know how I could download the games OGG files at runtime to use them? My soundbase consumes alot of memory and makes the game pretty big. Any ideas?

Thanks :)

letmethink

  • *
  • Posts: 2545
You can use this to stream the sound:

Code: [Select]
var mySound = new openfl.media.Sound(new openfl.net.URLRequest('http://soundimage.org/wp-content/uploads/2015/06/Classy-8-Bit.mp3'), new openfl.media.SoundLoaderContext(0.5,false));
mySound.play();

Change the URL to the URL of the sound you want to play. I haven't looked into how to loop this etc, but I'm fairly sure it is possible.
~Letmethink

stefan

  • *
  • Posts: 2263
You can use this to stream the sound:

Code: [Select]
var mySound = new openfl.media.Sound(new openfl.net.URLRequest('http://soundimage.org/wp-content/uploads/2015/06/Classy-8-Bit.mp3'), new openfl.media.SoundLoaderContext(0.5,false));
mySound.play();

Change the URL to the URL of the sound you want to play. I haven't looked into how to loop this etc, but I'm fairly sure it is possible.

I never did custom code before, but wouldn't it be as simple as storing the value of that URL in a sound attribute and loop that sound attribute?

letmethink

  • *
  • Posts: 2545
Sound attributes are part of a Stencyl made class, while this sound you download is an openfl sound. There is some conversion you have to do, but as I said I haven't looked into it yet (but will upon request).
~Letmethink

stefan

  • *
  • Posts: 2263