Animation: onStart method

Martin Sladecek martin.sladecek at oracle.com
Fri May 10 00:28:15 PDT 2013


Hi Sebastian,

This is currently not possible. There's a JIRA issue for more 
Animation/Transition events here: 
https://javafx-jira.kenai.com/browse/RT-14455, so don't forget to vote 
for it ;-).

Unfortunately, there's no reasonable workaround. One dirty fix might be 
wrapping such animation in a ParallelTransition, with a 0-length 
Timeline before it, putting the code in the it's onFinishedProperty.

Regards,
-Martin

On 05/10/2013 09:09 AM, Sebastian Rheinnecker wrote:
> Hello,
>
> is there something like an onStart property in Animation, just like 
> onFinished? Currently, if I want to do some stuff prior to executing a 
> Transition, for example, I have to do something like
>
> void playTranisition(){
>   doStuff();
>   doSomeOtherStuff();
>   transition.play();
> }
>
> Where as
>
> transition.onStartPropery().set(new EventHandler<ActionEvent>() {
>       @Override
>       public void handle(ActionEvent event) {
>         doStuff();
>         doSomeOtherStuff();
>       }
> });
>
> would be far more convenient, since I could use this together with 
> SequentialTransition and ParallelTransition and the like. Currently, I 
> have to set a Handler on the onFinishedProperty of the preceding 
> Transition (which blows up the code and leads to complicated adding 
> and removing the listeners).
> Or am I missing something here?
>
> Kind regards,
>
> Sebastian
>



More information about the openjfx-dev mailing list