Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.)
Copy link to clipboard
Copied
Sure, this is a bit complicated because I use the buttons in multiple ways. What I've done is give you the simplest example, my back buttons. I'll be happy to provide explanations of the other ways I use buttons, but the same problem occurs regardless of the application, so I don't know how relevant that is.
The first image below shows a frame with the back button opened. The timeline is in the upper left; the button is in the button bank at the lower left. I'm not sure how useful this shot of the entire screen is to you, so the second image zooms in on the timelines and buttons. As you see I put a green square in the Hit frame to define the hit area. The square is a graphic symbol, although I often use vector objects with other buttons.
I do use code to program the buttons. I've provided that beneath the images.
Please let me know if you have questions or if you would like anything else.
var _this = this;
_this.BTN_Name.on('click', function(){
_this.gotoAndStop("previousFreezeFrame");
stopPropagation();
});