vendredi 20 janvier 2017

Simplifying code as3

I am still working on a project with pies. Going to the next level. Now I have this code that is repeating all the time and i am trying to make it simple and less code. So this code is repeated for pie 2 till 12. When I trie to use the toString command for the pie_mc i get an error that it 's not working for the MovieClip symbol. How can I solve this?

if(counter == 2) {
  pie_mc = pie2_mc;
  pie_mc.visible = true;
  for (i=1; i <= counter; i++){
    partx_mc = "t"+ counter.toString()+"_p"+i.toString()+"_mc";
    pie_mc[partx_mc].alpha = 0.6;
    pie_mc[partx_mc].addEventListener(MouseEvent.CLICK, showPiepart);       
    }
}

Aucun commentaire:

Enregistrer un commentaire