What does addChild/removeChild do to memory in Actionscript 3? -


I do not understand how memory works in Epistula 3. I prepare several buttons and store each one of them in an array, those buttons are used to play different music files, and I want to see that one is a special color (red) and The rest are playing to be white I call the following code when the currently selected button should be replaced with a different button:

  removeChild (songSelectButton [currSong]); Var Songs Selvight: Button = New Button (empty, "Picture / Track Button nose .jpg", TRACK_SELECT_WIDTH, TRACK_SELECT_HEIGHT); Song cheek button [karasong] = lyrics white;   

This allows the array to have the right buttons, however, I am worried whether I am wasting memory or not. Does garbage collection take care of this or do I need a better approach?

In most cases, the garbage collection is very clever and can clear whatever makes a mess . But it can take around its time, and it can actually bind the CPU when it decides that it is to talk so careful management of memory is valuable.

In your case, why create a new button? You already have a button, and it already looks in the right place and everything just to change the image, any audience, and any other properties that you really need to change, then you can click the new button There will be no need to worry about being allocated and distributed, and you will not have to worry about calculating the new layout.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -