Papa De Beau
Papa De Beau

Reputation: 3828

as3 - using resources - better to preload sounds or load them on the fly

I have a loop that will be loading a new sound every minute. My questions is... I am wondering if it is better to load all 50 at once and play them when needed every minitue or is it better to load the sounds right before I play them?

What is the best way to save resources?

This is for a cell phone app so I need to use all resources very carefully.

Upvotes: 0

Views: 68

Answers (1)

Nicolas Siver
Nicolas Siver

Reputation: 2885

It's a good practice to use resources on demand (load sounds when user needs them), especially in resource restricted environments like mobile devices. Every sound object will consume memory. So answer will be: load sound on demand, after playback, unload it by setting reference on sound object to null, load and play another one. If you loading them, from the network, You should load several sounds, for example current and next one, because for mobile devices, network process will turn on radio, and switching radio is battery consuming process.

Network sound loading: load several on demand (for example current and next one)

Filesystem loading: load only current on demand.

Upvotes: 1

Related Questions