Hi… I wonder if someone could take a look at my code.
Basically I want to eval() a string like _level0.mc._x-=dist; where the “-” or “+” is a variable.
You can paste this straight in and it should work… only the last part (where it’s doing the eval) doesn’t!!
Any ideas would be really appreciated:
this.createEmptyMovieClip("mc",this.getNextHighestDepth());
_level0.mc._x=200;
_level0.mc.createTextField("txt",_level0.mc.getNextHighestDepth(),0,0,200,200);
_level0.mc.txt.htmlText="text";
this.slide=function (mc, prop, dir, dist)
{ trace(eval(mc+"."+prop));// this returns 200 as expected
trace(mc+"."+prop+dir+"=dist;");// this returns _level0.mc._x-=dist; which is the line I want to eval
eval(mc+"."+prop+dir+"=dist;");// this DOESN'T eval it - any idea why?
//_level0.mc._x-=dist;// this works!!
}
_level0.mc.onEnterFrame=function ()
{ _level0.slide("_level0.mc", "_x", "-", 3);
};