Make a button do a different thing after few seconds in java
Application Type
Reactive

Hey guys, i was thinking if you could help me with this issue which i have no idea where to start

i want to make a button make one thing in the few 5 seconds, and another different thing after that

 e.g.: a music that has 4 minutes, in the first five seconds, you click and it goes back to the beginning, but after that, it goes to the previous song.


(and if you don't mind answering this too, how do you change the text of a button after pressing it too? attached to the image)

imagem_2021-10-24_223506.png

mvp_badge
MVP

Hi Gabriel,

You'd make the distinction in the Screen Action that gets triggered when you press the button. If you want to change the text on the button, create a Local Variable that holds the text, and update it inside the Screen Action.

Hello @Gabriel de Melo

Attached is an oml that is quite simple to understand. It does not use any javascript.

  1. Builld and run the oml
  2. Click on Play - this triggers an action, which after 5 seconds, changes the text on the 'Replay' button to 'Next' as shown below.

I hope this guides you and you can expand on it. There are surely other options that involve javascript but I chose to keep it simple.

Regards,

AJ

FirstFiveSeconds.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.