|
User Details |
message
|
|
grisu
post date:
2009-04-16 07:44:01
|
|
Is it possible to call a self-defined function when the out-effect has finished by just using AS3 (no button events or something)? I found the event-triggered action used with button (press, rollout,...) but I don't use any buttons. I want to trigger my function automatically when the out effect has finished.
|
|
|
Andrei Rinciog [Extend Studio]
post date:
2009-04-16 10:59:44
|
Hello,
The component throws several events that can be accessed through the TweenEvent class. Those events are :
public static const MOTION_START:String = 'motionStart';
public static const MOTION_STOP:String = 'motionStop';
public static const MOTION_FINISH:String = 'motionFinish';
public static const MOTION_CHANGE:String = 'motionChange';
public static const TIME_CHANGE:String = 'timeChange';
public static const DIRECTION_CHANGE:String = 'directionChange';
If you need more help with this just send an email at support at extendstudio.com.
Best regards,
Andrei Rinciog
|
|
|
grisu
post date:
2009-04-21 08:39:36
|
That's good news! Can you please post a short example which shows how to catch the motionFinish Event in AS3, please?
Best regards,
grisu
|
|
|
Andrei Rinciog [Extend Studio]
post date:
2009-04-21 11:56:02
|
Hello,
Here's an example on how to catch the events sent by the component.
import xtd.FLAnima.XTDTweener.*;
tfx.textFX.addEventListener(TweenEvent.MOTION_START, eventHandler);
tfx.textFX.addEventListener(TweenEvent.MOTION_FINISH, eventHandler);
tfx.textFX.addEventListener(TweenEvent.MOTION_STOP, eventHandler);
tfx.textFX.addEventListener(TweenEvent.MOTION_CHANGE, eventHandler);
function eventHandler(e:TweenEvent):void {
switch (e.type) {
case "motionStart" :
// code that runs on motionStart
break;
case "motionStop" :
// code that runs on motionStop
case "motionFinish" :
// code that runs on motionFinish
break;
case "motionChange" :
// code that runs on motionChange
break;
}
}
“tfx” is the instance of the component on the stage. I will also send a FLA by email with this example.
Regards,
Andrei Rinciog
|
|
|
grisu
post date:
2009-04-23 03:30:48
|
Hello Andrei,
Thx for your example. It works perfectly!
Best regards,
grisu
|
|