6 Replies Latest reply on Nov 1, 2007 9:53 PM by kglad

    evaluate variable name in a loop in cs3

      I want to generate variable names in a loop and assign a object refe. to it.

      ex. public var missing1_mc:MissingGameObjects;
      public var missing2_mc:MissingGameObjects;
      public var missing3_mc:MissingGameObjects;
      public var missing4_mc:MissingGameObjects;

      Now in a loop i want to do the following;

      var ClassReference:Class ;
      var missing_obj:String;

      for(var i=0;i<usedNo.length;i++){
      missing_obj = main_obj + "_" + usedNo [ i ] + "_x";
      ClassReference = getDefinitionByName(missing_obj) as Class;
      "missing"+ (i +1) + "_mc" = new ClassReference(); //wrong code
      "missing"+ (i +1) + "_mc".setpos(150,100);//wrong code

      How could i do this. Any help is appreciated.