views:

21

answers:

2

How i can convert gecko object to a movie clip

function finish(boxname, arrayname:Array):void {

for each (var item:String in arrayname) {
    trace(boxname+"_"+item);
    var gecko:MovieClip = (boxname+"_"+item) as MovieClip ;
    trace(typeof(gecko));
    gecko.gotoAndPlay("glow");
    }

  }

i get the following error

high_hsymbol_1 object TypeError: Error #1009: Cannot access a property or method of a null object reference. at quizz_fla::MainTimeline/finish() at quizz_fla::MainTimeline/dropIt()

+3  A: 

boxname+"_"+item should be a reference to a movieclip, no need for casting which i think is not possible from a string to a movieclip. You do this with associative arrays. I supposed the movieclips are childs of "this":

var gecko:MovieClip = this[boxname+"_"+item];
Cristi Băluță
A: 
this.getChildByName(boxname + "_" + item);
Amarghosh