I have created a function that applies a set of tweens to a movieclip. This function has a number of parameters, one of which I need to be the name of a function that is called when the tween is finished. The tweening itself works just fine. It is getting it to call a function specified as a string or other means passed as a parameter that is not working.
Here is an abbreviated example of the code:
[FONT=Courier New]//Inside the movieclip [/FONT]
[FONT=Courier New]doSpecialTween(this, 100, “callWhenDone()”);[/FONT]
[FONT=Courier New]//In root[/FONT]
[FONT=Courier New]_global.doSpecialTween = function(objectName, amount, endingFunction) {[/FONT]
[FONT=Courier New]//The tween itself is working just fine[/FONT]
[FONT=Courier New]myTween = new mx.transitions.Tween(objectName, “_alpha”, mx.transitions.easing.None, 0, amount, 1, true);[/FONT]
[FONT=Courier New]//It is getting the function name passed as a parameter to execute[/FONT]
[FONT=Courier New]myTween.onMotionFinished = function() { eval(endingFunction) }[/FONT]
[FONT=Courier New]}[/FONT]
[FONT=Courier New]function callWhenDone() {[/FONT]
[FONT=Courier New]trace(“tween finished!”);[/FONT]
[FONT=Courier New]}[/FONT]
[FONT=Courier New][/FONT]
Any ideas???