Hi All,
How to pass a value to a function while its calling thru ‘Montion_change’ or ‘Motion_Finish’ or …
here I try to pass a value to “tweenEvent function” while that function called… i m using a private variable inside ‘mainfunction’ (dont tell create that variable out the function ), i just assigning a string value to that variable. after this, i m starting a tween and when the tween started calling ‘tweenFunction’ using addEventListener,
Inside ‘tweenFunction’ function, i try to trace the ‘Name’ variable which is inside the mainfunction… not working !!!
Here my code…
import fl.transitions.;
import fl.transitions.easing.;
function mainFunction() {
var Name:String;
var MC:MovieClip=drawCircle();
MC.x=MC.y=100;
addChild(MC);
Name=“karthic”;
var newTween:Tween=new Tween(MC,“x”,Strong.easeOut,100,500,5,true);
newTween.addEventListener(TweenEvent.MOTION_CHANGE, tweenFunction(Name));
}
mainFunction();
function tweenFunction(evt:TweenEvent, Name):void {
trace(Name);
}
function drawCircle() {
var circle:MovieClip=new MovieClip();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(0,0,20);
return (circle);
}