mercredi 15 février 2017

Flash AS3 - Remove Multiple addChild

I am using the following to add a repeating animation.

var recC01: cube01;
function attachC1() {
    recC01 = new cube01();
    recC01.x = -158;
    recC01.y = 159;
var myIntervalC1: uint = setInterval(attachC1, 500);

The repeating animations are added at various keyframes with unique names. ie. recC01, recC02, etc. as well as attachC1, attachC2, etc.

During playback the user is able to click a "Back" button to rewind to the previous section. I am struggling because the button appears on the timeline before the instances so I cannot use clearInterval and Removechild for an instance that does not yet exist. I'd like to avoid creating unique var everytime a new child is added. Keeping track of that would be crazy.

The user could click the back button before any of these are loaded or in between say recC01 and recC02...

What is the best way to remove all of the child instances? Is there a method to listen for the Interval and Child and then

Aucun commentaire:

Enregistrer un commentaire