Hi
How to make the same button when pressed causes two events:
-
Pause and replay the audio
-
Toggle button image between pause.jpg and resume.jpg
Hi
How to make the same button when pressed causes two events:
Pause and replay the audio
Toggle button image between pause.jpg and resume.jpg
A good starting point is this tutorial on swapping images:
https://docs.coronalabs.com/tutorial/media/swapImages/index.html
From there, you’ll have to code the rest: probably manage a simple boolean variable of true/false on the “state” of the audio. If it’s currently playing when the event occurs, pause it. If it’s currently paused when the event occurs, resume playing it.
Hope this helps,
Brent
Thank you
This is a good solution that worked with me, and you modify the code
I’ll put the code here later because I’m busy now
Hi alharbi,
If you don’t feel too much coding this, you can also use my plugin that also support double state button as shown here :
Best,
Nick
A good starting point is this tutorial on swapping images:
https://docs.coronalabs.com/tutorial/media/swapImages/index.html
From there, you’ll have to code the rest: probably manage a simple boolean variable of true/false on the “state” of the audio. If it’s currently playing when the event occurs, pause it. If it’s currently paused when the event occurs, resume playing it.
Hope this helps,
Brent
Thank you
This is a good solution that worked with me, and you modify the code
I’ll put the code here later because I’m busy now
Hi alharbi,
If you don’t feel too much coding this, you can also use my plugin that also support double state button as shown here :
Best,
Nick