Link to home
Start Free TrialLog in
Avatar of djnathanjones
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="HelveticaNeue 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.onMotionFinished = function() {
      //trace("OnMotionFinished function");
      TextScript.typewriter(this, phrase, xLoc, yLoc, myFormat, delay);
};

Thanks in advance for your help.
ASKER CERTIFIED SOLUTION
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of djnathanjones
djnathanjones

ASKER

Awesome, thanks!!!!