I would like you to help me create a javascript where I can have 4 rectangles and when I click on the first one, the second one appears and the first one is hidden and so on.
Sorry about my English.
To create a project having 4 rectangles which are shown and hidden in turn when you click one of them, simply set the events-actions for these 4 shapes as the enclosed project:
Hi. Good morning.
I had already done that process, but using a lot of slides and text boxes is too much work. I need something like a script which provides me with a counter that shows the next text box and hides the current one.
In such complicated project like yours, using javascript can help you save some time. Here are 2 lines of code used to show/hide an object that may be useful for you:
You just need to add the Execute Javascript action to On Click event of each shape. Then paste the 2 lines of code above, and adjust the appropriate object.
For other objects, just copy the events-actions of one shape and paste to others; and adjust the object name appropriately.
Below is a screenshot for doing that.
Hello Good morning. The click function works, but the audio in the rectangle is not playing as it moves to the next.
Sorry to bore you, but I’m breaking my head to do it.
I would like something generic like:
If click on object_1 then do: {}
Else If click on object_2 do: {}
Else if click on object_3 do: {}
So that it can be used on all rectangles without the need for alteration.
Please see the script in On Load event of the first slide in this sample: test_box_text.approj (1.4 MB)
Please be noted that attached audio is not played/stopped automatically when showing/hiding an object by script. You must invoke a function to play/stop it.
After a while using the current script, I would like to make a change.
Place 2 buttons, forward and backward.
Where one goes to the next box and the other goes back to the previous one.
Is there any way to do this?