Skip to main content
BioME
Known Participant
November 3, 2022
Question

Wonky Buttons with Canvas

  • November 3, 2022
  • 1 reply
  • 358 views

Can anyone explain how to get buttons to function correctly with Canvas?  What’s happening is when I hoover over a button its display shifts from its Up to Over frame as it should.  If I click the button the display shifts to the Hit frame, again as it should.  Here’s where it goes wrong.  If I move the mouse off the button it should go back to the Up frame, but instead it goes to the Over frame.  Then if I hoover over the button again, it goes to the Hit frame.  If I click the button at this point it remains on the Hit frame. 

 

So, it’s like once a button is clicked it gets stuck on its Over frame and won’t return to the Up frame.  I should note that if the timeline progresses to a frame without the button, and then returns to the frame with the button, the button remains stuck on its Over frame.

 

This goes without saying, but to be clear this didn’t happen with the old SWFs.

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    November 3, 2022

    button's never go to the hit frame.  the hit frame simply defines the region that triggers over and down states and then up.  ie, up, over and down frames are visible, although with canas over is only triggered if enabled -

     

    stage.enableMouseOver(10)

     

    with that in mind, if you still think there's a button malfunction, can you explain what  are you're seeing?

     

     

    BioME
    BioMEAuthor
    Known Participant
    November 3, 2022

    I stand corrected, sorry for the confusion.  I composed the message last thing last night before I went to bed.  Anyway, I meant Down frame, not Hit.  To minimize continued confusion, I copied my original message below, changing Hit to Down frames.

     

    Can anyone explain how to get buttons to function correctly with Canvas?  What’s happening is when I hoover over a button its display shifts from its Up to Over frame as it should.  If I click the button the display shifts to the Down frame, again as it should.  Here’s where it goes wrong.  If I move the mouse off the button it should go back to the Up frame, but instead it goes to the Over frame.  Then if I hoover over the button again, it goes to the Down frame.  If I click the button at this point it remains on the Down frame. 

     

    So, it’s like once a button is clicked it gets stuck on its Over frame and won’t return to the Up frame.  I should note that if the timeline progresses to a frame without the button, and then returns to the frame with the button, the button remains stuck on its Over frame.

     

    This goes without saying, but to be clear this didn’t happen with the old SWFs.

    kglad
    Community Expert
    Community Expert
    November 3, 2022

    what's in your hit frame?

     

    actually, copy screenshots (from animate) and paste (here), the up, over, down and hit frames/ stage.

     

    (and i assume you have no code for the problematic button, or you'll need to show that too.)