djnathanjones
asked on
Event Handler Help
Greetings,
I'm having trouble with an onMotionFinished Event Handler. I have a box that slides accross the stage and once it stops I want the onMotionFinished event handler to execute some code that will write a title in front of the box. For some reason the code that writes the title won't execute when placed within the onMotionFinished event handler. It works when it's placed outside of the event handler, but I need it to start writing once the box has stopped. When I trace the event handler the trace message comes through fine. Not sure what I'm doing wrong...
Here is what I have:
import mx.transitions.*;
import mx.transitions.easing.*;
import classes.TextScript;
var myFormat:TextFormat = new TextFormat();
myFormat.font="HelveticaNe ue BoldExt";
myFormat.bold = true;
myFormat.size = 18;
myFormat.color = 0xFFFFFF;
var phrase:String = "Phase 01:";
var xLoc:Number = -13;
var yLoc:Number = 10;
var delay:Number = 1;
var tween_handler:Object = new Tween(box_mc, "_x", Regular.easeInOut, 0, 150, 30, false);
tween_handler.onMotionFini shed = function() {
//trace("OnMotionFinished function");
TextScript.typewriter(this , phrase, xLoc, yLoc, myFormat, delay);
};
Thanks in advance for your help.
I'm having trouble with an onMotionFinished Event Handler. I have a box that slides accross the stage and once it stops I want the onMotionFinished event handler to execute some code that will write a title in front of the box. For some reason the code that writes the title won't execute when placed within the onMotionFinished event handler. It works when it's placed outside of the event handler, but I need it to start writing once the box has stopped. When I trace the event handler the trace message comes through fine. Not sure what I'm doing wrong...
Here is what I have:
import mx.transitions.*;
import mx.transitions.easing.*;
import classes.TextScript;
var myFormat:TextFormat = new TextFormat();
myFormat.font="HelveticaNe
myFormat.bold = true;
myFormat.size = 18;
myFormat.color = 0xFFFFFF;
var phrase:String = "Phase 01:";
var xLoc:Number = -13;
var yLoc:Number = 10;
var delay:Number = 1;
var tween_handler:Object = new Tween(box_mc, "_x", Regular.easeInOut, 0, 150, 30, false);
tween_handler.onMotionFini
//trace("OnMotionFinished function");
TextScript.typewriter(this
};
Thanks in advance for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER