PDA

View Full Version : eval ()


matt poole
10-21-2002, 12:06 PM
Im using this code:

dropTarget = this._droptarget;
getTarget = dropTarget.substr(1, 10);
doTargetAlpha = eval(getTarget);
_root.doTargetAlpha._alpha = 50;

The _droptarget property returns a string with a '/' on it so I've used the substr() method to select the bit of the string I need (this works fine). They Im trying to convert the stirng contained in the getTraget variable to an identifier using the eval() method and then intend to use it to affect the alpha of the _droptarget clip.

However the eval() is returning 'undefined' every time.

can anybody help?

sfa
10-23-2002, 01:55 PM
Try this-

dropTarget = this._droptarget;
getTarget = dropTarget.substr(1, 10);
_root[getTarget]._alpha = 50;

or this

_root[this[this.dropTarget.substr(1,10)]]._alpha = 50;

SFA