vendredi 17 juin 2016

Flash AS3 ReferenceError: Error #1056: Cannot create property

I am following a tutorial on making a rhythm game in Flash, and am new to AS3. I keep getting this error:

ReferenceError: Error #1056: Cannot create property destroy on flash.display.Shape.
at source_fla::MainTimeline/removeButtons()[source_fla.MainTimeline::frame5:27]
at btnSongSelect/clickThis()[btnSongSelect::frame1:25]

referring to the following code:

//this function will remove all of the buttons from the stage
function removeButtons():void{
    //we're going to use the same loop
    for(var i:int=0;i<numChildren;i++){
        var remove = getChildAt(i);
        //set the target's destroy variable to true
        remove.destroy = true;
    }
}

Can someone please explain to me the cause of the error and a possible fix? Thank you.

Aucun commentaire:

Enregistrer un commentaire