samedi 11 mars 2017

addChild with looping, diferent name, and access variable

here is my code

stop();
var card:mc;
for (var c:int = 1; c <= 2; c++){
    card = new mc()
    card.name = "card"+c
    addChild(card);
    this["card" + c].gotoAndStop(c);
    trace(["card" + c].var1);
    trace(["card" + c].var2);
}

in the movie clip i have two variable called var1 and var2 in the frame 1 and 2

but I get Error #1010: A term is undefined and has no properties. at Untitled_fla::MainTimeline/frame1()

Aucun commentaire:

Enregistrer un commentaire