• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Buttons Stuck on Over frame

Explorer ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

This is a follow up to a post I submitted last November, labeled "Wonky Buttons with Canvas."  kglad responded, but didn't followup to my last response which I imagine means he couldn't answer the question, no problem.  However, this is important to my project so I want to be sure that no one has any suggestions.

 

What's happening is if I click a button it gets stuck on the over frame.  When I move the cursor off the button after I've clicked it doesn't go back to the Up frame. Instead, it goes to the Over frame.   

 

Does anyone have any suggestions, or is this just a bug with Canvas that we have to live with?

Views

473

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 30, 2023 Jan 30, 2023

Hi.

 

You shouldn't need code to only change a button to the Over and Up frames. If you use the default Button symbol, Animate will handle this interactivity automatically for you.

 

Also, by only calling stopPropagation will cause a runtime error. If you really need to use it, you must call it on the event object. Like this:

this.yourButton.on("click", function(e){ e.stopPropagation(); });

 

And for other users, I would like to emphasize that buttons never go to the Hit frame. The instances pla

...

Votes

Translate

Translate
Community Expert ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

don't remember that, but upload your fla to a file server and post a link here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Thanks so much kglad.  Don't worry about not remembering.  You're so supportive to so many that I for one would never fault you if an inquiry falling through the cracks.  I will post a fla on a server as you ask, but right now my laptop is in my IT department for repairs so it may take a few days.  I'll let you know when it's ready.  In the meantime, if you want to review the previous inquiry then you could look up the Wonky Buttons with Canvas conversation we had last

fall.  If you don't have time don't worry about it, you can just look at the fla when I get it up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

oh, no need to upload your fla. i see the problem from your other thread.

 

when you use:

 

var _this = this;

_this.BTN_Name.on('click', function(){

_this.gotoAndStop("previousFreezeFrame");

stopPropagation();

});

 

stopPropagation() is going to prevent any response to the click event after that code excutes, including the button responding after it goes to the down frame.  ie, remove that stopPropagation() and your button will behave as you expect.

 

if you need stopPropagation() for something else, see if you can use a "pressup" event instead of "click". the pressup even won't interfere with the button changes you expect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

Kglad will help you figure it out. Even if he doesn't know it, he will figure it out. Just get him the file or your code. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hi.

 

You shouldn't need code to only change a button to the Over and Up frames. If you use the default Button symbol, Animate will handle this interactivity automatically for you.

 

Also, by only calling stopPropagation will cause a runtime error. If you really need to use it, you must call it on the event object. Like this:

this.yourButton.on("click", function(e){ e.stopPropagation(); });

 

And for other users, I would like to emphasize that buttons never go to the Hit frame. The instances placed in there will only be used as region/area for mouse interactions.

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Thanks for the advise JoãoCésar, very helpful.  You are correct that I don't need code for my buttons to change between the up and over frames, but I do need it to program the buttons so they will do what I need them to do.  Kglad has already advised that I should remove the stopPropagation command, and I'm anxious to try it.  Unfortunately, my laptop is in repairs right now; I'm using a loaner for communications.  I will experiment with you code for incorporating a stopPropagation command when needed.  I'm forgeting why I put it in the first place so I may need it, although I bet I don't. Thanks again, BioME

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

Just letting folks know the bug is fixed.  Turns out I did need the stopPropagation command, but adding the event parameter as JoãoCésar suggested solved the problem.  Without the stopProgation command, what was happening when I clicked a back button is that it would go back to the designated keyframe in my timeline, but then it would just play back to the current keyframe, even though I used a gotoAndStop command.  Thanks kglad and JoãoCésar for helping work this out, BioME

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

LATEST

You're welcome!

 

Glad you figured it out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines