3 Replies Latest reply on Apr 15, 2012 1:58 PM by Ned Murphy

    can i do this (use a counter "i" in instance name)

    alaStickman

      hello,

      i have  5 Dynamic Text object in my scene and i need to do a treatement for them (compare each one to the other)

      my Text instance names are :

      to0,to1,to2,to3,to4

      and their variable names are :

      t0,t1,t2,t3,t4

      what i need to do is :

      if (t0>t1) then to0 will move to the place of to1 and to1 will move to the place of to0

       

      till now i have no problem to compare 2 elements and change their place but what if i have a large number or an unknow number of elements , i know that i can (should) a for loop but the problem is that i can't do this

      for examle let's say that i have 10 elements :

         

      for(i=0;i<10;i++){

                if(t[i]>t[i+1]){

                  exchange(to[i],to[i+1]);

                }

           }

      //this code work perfectly when i work with an array

      i hope that you understand my problem, i don't need someone to tell me how to apply a sort in a table all i want is the ability to use a counter on an instance/variable name of a MovieClip,DynamicText,etc...

       

      thank you