PDA

View Full Version : calling functions dynamicallyyy



kupreg
October 13th, 2003, 11:27 AM
hmmm. i'm trying to call a function on a clip, but i want to use a variable that i'm sending to the clip so that when the one function gets done it knows what to do next. i just have no idea of what the syntax would be. here's a sample.

MovieClip.prototype.moveHere=function(x,y,spd,func ){
this._x+=(x-this._x)/spd;
this._y+=(y-this._y)/spd;
if(Math.abs(this._x-x)<1 && Math.abs(this._y-y)<1){
this._x=x;
this._y=y;
trace("done" add func);
if(func!=null){
//the function i want to call is
this.menu();
//but i want to use the variable func
//i think i need to use ['s but i have no idea the exact use. is it something like this below?
this[func add "()"];
}
this.onEnterFrame=null;
}
}

danke

kode
October 13th, 2003, 11:38 AM
this[func]();
;)

kupreg
October 13th, 2003, 12:44 PM
thanks killer

kode
October 13th, 2003, 12:47 PM
Welcome. :beam: