ProUI - Collection of Addons for UI

6 favourites
From the Asset Store
Old school pixels for your UI! Over 800 assets for all you needs!
  • Hello, Does anyone know how to dispatch a click/touch event from JavaScript so that the PRO UI Button behavior handles it (so that I can trigger a click event on the given PRO UI Button behavior)?

    Something like this (but this one does not work...):

    const event = new C3.Event("Click");
    runtime.objects.myButton.getFirstInstance().behaviors.Button.dispatchEvent(event);
    

    Is it possible at all, somehow?

    What I am trying to achieve is that if I have two sprites one on the other then clicking on them only triggers the Button behavior for the one on the top. I have different behaviors appleid to each sprites and I would like to run both on click/touch.

    Here is what happens currently when I click on the foreground sprite and after that I click on the background sprite:

    szabesz.hu/_dl/who-to-trigger-both-events.gif

    Any ideas how to achive that?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry for the wrong attempt to insert a gif, clearly, I have no idea how I should do that.

    I am not jet allowed to edit my post as this is my second post on the forum. I am sorry for not being able to use the forum properly.

  • szabesz

    If you want a specific bottom button to intercept the clicks too, you can set this property : "Ignore Input" to false in the button behavior.

    If you want this kind of behavior applied to ALL of your buttons project, then set "stop click propagation" to NO in the proui plugin propery panel, but you probably dont want that.

  • can you create a GUI for normal apps?? best regards, Lestroso

  • can you create a GUI for normal apps?? best regards, Lestroso

    I don't recommand doing that.

  • szabesz

    If you want a specific bottom button to intercept the clicks too, you can set this property : "Ignore Input" to false in the button behavior.

    If you want this kind of behavior applied to ALL of your buttons project, then set "stop click propagation" to NO in the proui plugin propery panel, but you probably dont want that.

    Aekiro

    Thank you for your quick reply! Now I know what "Ignore input" means, I should have tried that, I guess.

    If I set it to "No" then the event propagates to the sprite in the background as expected. So clicking on the sprite above the other one works this way. However, clicking on the sprite below the front one does not make the two behaviors work at the same time because the JS event does not propagate "backwards". The sprite on the front is transparent, so it does not receive the click event when clicking on a transparent area, I think.

    So how is it possible to make this combo work no matter which sprite I click on? Am I missing something, perhaps?

    I am happy to code it in JavaScript if that is the only way to solve it. Is there an interface for the button just like the Scirra behaviors have? Of course, if I can do it wihotut JavaScript, I am even more hapier that way.

    Thanks in advance.

  • fyi for posting gifs:

    the format is like this:

    [img="https://imgur.com/c9WBKlG.gif"]

    or

    [img="https://media.giphy.com/media/xuXpbn/giphy.gif"]
  • fyi for posting gifs:

    Thank you! As soon as I will be allowed to edit post, I will fix it.

  • Aekiro Any chance you can reply to my question above? Thanks in advance!

  • If the click happens on a point that belong to both sprites, then they will both register a click. Transparent area also get clicked.

    Check the top sprite collision box, maybe it's not.

    If you still can't achieve what you want, please reach me on discord (username = Aekiro#1066) with an anexmaple project. it's much faster to communicate there.

  • Thanks for the reply!

    Check the top sprite collision box, maybe it's not.

    If you still can't achieve what you want, please reach me on discord (username = Aekiro#1066) with an anexmaple project. it's much faster to communicate there.

    I will proceed accordingly.

  • Aekiro Just a follow up: actually the issue was this:

    Check the top sprite collision box, maybe it's not.

    I should have thought of this, thank you for pointing me in the right direction!

    Incidentally, I have not yet worked on C3 projects which did not use non-rectangular sprites, so even though I was aware of the importance of the polygonal collision box, I forgot about it.

  • When i use go to layout event and get this error. Is there any way to fix this?

  • can you click on that first link and show me the results ?

    Can we text on Discord ?

  • Hi, Aikiro

    how can I show the leaderboard data if my json file like this :

    {"-Aspo":10,"-Jingh":7,"-Lapo":13,"-Dino":1,"-Edgar":6,"-Eddie":0}

    Aspo is a name, and 10 is Score

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)