Random squares / slide

(David) #1


I have a question regarding a project I’m working on. I have 30 squares in one scene and all squares are numbered from 1 to 30. The numbers are also in random order. What I want too achieve is that you can click on any number you want and it will go to a specific scene/slide. For exsample when I click the number 12, it wil show a picture. But when you go back to the main scene, but number 12 should not be clickable any more. So you can’t click on a number ones you’ve already clicked it.

Can anybody tell/show me how too achieve something like this?

(Mark Hunte) #2

I was going to say use symbols.

But surprisingly this works…

When a square is clicked it goes to the scene but also runs a javascript which completely disables it’s pointer events.
i.e click mouse clicks.

element.style.pointerEvents = "none";

pointerEvents.hype.zip (37.3 KB)


Elegant Solution!

(David) #4

Wow perfect! Thnx! This really does the trick. I wanted to use symbols if there wasn’t any other solution, but this is way better.

(David) #5

One more question … is it possible, when you go back to the main scene after clicking a square, that this particular square is deleted (so you won’t see the clicked square)?

(Greg) #6

Similar to Mark’s script, just use…

// element.style.pointerEvents = "none";  // not needed if it will not be visible
element.style.display = "none";

(Mark Hunte) #7

Although you should just be able to use the display none code. Which should in effect hide plus stop user interaction

(David) #8

@gasspence Thnx! But element.style.display = “none”; doesn’t work for me. Could be that I’m doing something wrong. The “none” script of Mark worked really perfect because the square is disabled from clicking, but when I replace that script with the hide script … the clicked square is still visible and clickable when I return to the main scene. And when I use both scripts the square is still visible but not clickable.

Please advice

(Greg) #9

I’ll upload Mark’s demo with the 'display = none" script
pointerEvents2.hype.zip (35.9 KB)

(David) #10

Ooh hahaha, problem fixed! I was doing something wrong. The squares I’ve made were made using buttons, I’ve replaced the square buttons with plain squares and it works the way it supposed to be working.

@MarkHunte and @gasspence Thnx again! Really appreciate it. I am able to finish my project now.