Animation: onStart method
John Smith
send2jsmith at gmail.com
Fri May 10 01:22:19 PDT 2013
As a result of a lack of events for things like onCycleStart, I sometimes use a Timeline in places where a Transition seems more appropriate, because in the Timeline you can add a KeyFrame at Duration zero that effectively gets you a handler for an on start event.
On May 10, 2013, at 12:28 AM, Martin Sladecek <martin.sladecek at oracle.com> wrote:
> 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