Skip to main content
BSB2018
Known Participant
September 23, 2021
Question

Repurcussions on adding audio to the timeline in an MC for a game?

  • September 23, 2021
  • 1 reply
  • 152 views

Hey there. I just wanted to know if anyone has some ideas on performance / memory usage if audio clips are added to the timeline as events, instead of using code to play them back?

 

If a timeline is full of sounds being played back, is there anything special i need to do for garbage collection? Are they sitting in memory before they are played because the entire MC is on the stage? Do they prevent an MC from being garbage collected once it's removed from the stage?

 

I hope i'm being clear enough, not sure how else to ask this.

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 28, 2021

removing an object from the display list does not ready it for gc.  it must be removed and all references removed.

 

eg, for any referenceable display object (with only one reference), with our without, sounds, video etc, :

 

 

if(dobj.stage){

dobj.parent.removeChild(dobj);

}

dobj = null;

 

will ready the object for gc

 

}