Skip to main content
Known Participant
February 11, 2021
Question

Multiple buttons - not working

  • February 11, 2021
  • 1 reply
  • 476 views

I have a project with many frames of artwork and nested animations. The code is very simple but it is freezing up on the later frames. Advanced layers is turned off, I do not have any alphas, artwork is bitmapped and I'm using instance names. I have replaced this a few times but with no luck - it just freezes. I had this on frame 5 as well a few days ago.  Is animate getting scrambled or is my code incorrect?

 

Please see below... 

this.stop();
 
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
 
function fl_CustomMouseCursor() {
    this.greendot8.x = stage.mouseX / stage.scaleX;
    this.greendot8.y = stage.mouseY / stage.scaleY;
    
}
 
this.jelly1.addEventListener("click", fl_ClickToHide_47.bind(this));
 
function fl_ClickToHide_47()
{
this.jelly1.visible = false;
this.splash1.visible = true;
this.splash1.play();
}
 
this.jelly2.addEventListener("click", fl_ClickToHide_48.bind(this));
 
function fl_ClickToHide_48()
{
this.jelly2.visible = false;
this.splash2.visible = true;
this.splash2.play();
}
 
this.jelly5.addEventListener("click", fl_ClickToHide_49.bind(this));
 
function fl_ClickToHide_49()
{
this.jelly5.visible = false;
this.splash5.visible = true;
this.splash5.play();
}
 
this.jelly3.addEventListener("click", fl_ClickToHide_50.bind(this));
 
function fl_ClickToHide_50()
{
this.jelly3.visible = false;
this.splash3.visible = true;
this.splash3.play();
}
 
this.jelly4.addEventListener("click", fl_ClickToHide_51.bind(this));
 
function fl_ClickToHide_52()
{
this.jelly4.visible = false;
this.splash4.visible = true;
this.splash4.play();
}
 
this.arrBlueL8.addEventListener("click", fl_ClickToGoToAndStopAtFrame_69.bind(this));
 
function fl_ClickToGoToAndStopAtFrame_69()
{
this.gotoAndStop(7);
}
 
this.arrRightNew.addEventListener("click", fl_ClickToGoToAndStopAtFrame_70.bind(this));
 
function fl_ClickToGoToAndStopAtFrame_70()
{
this.gotoAndStop(8);
}
 
I also want to do a drag and drop but cannot figure out make it work without a code snippet.
Comments welcome. 😊
    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    February 11, 2021

    Hi.

     

    Are there any error messages on the browser console?

     

    Also, is the frame in which you wrote the code being revisited? Because it's possible that your event listeners are being added more than once.

     

    Please let us know.

     

    Regards,

    JC

    cmdhAuthor
    Known Participant
    February 11, 2021

    Hi JoãoCésar,

     

    Thank you for responding to my inquiry! For this animation segment, I have 12 frames, with an average of 4 buttons in each frame ( True / False, click to hide, drag and drop if I can figure out how to do it). This morning, I renumbered every peice of event listener code so it has it's own "number" (gotoandstop / clicktohide) and it still does not work - same thing buttons are inactive and frame 8 freezes. Still no luck... Comments are welcome. 😊

    Console notes below - not sure if the numbers correspond to frames in question.

     

    I have removed transparancies and simplified each frame considerably. Does Animate have a known glitch when using many frames?  Should I invest in learning a different program (Unity)? I welcome feedback about learning the basics of C# if needed. I have on average 20 frames for each segment, with simple tweened / nested animation and I need to get these done for a presentation soon.  

     

    Many Thanks,

    cmdh

     

    Canvas output notes below:

    "WARNINGS:

    Frame numbers in EaselJS start at 0 instead of 1. For example, this affects gotoAndStop and gotoAndPlay calls. (208)

    Color effects are published as a filter and subject to the same limitations. (40)

    Filters are very expensive and are not updated once applied. Cache as bitmap is automatically enabled when a filter is applied. This can prevent animations from updating. (15)

    Applying "cache as bitmap" to an animated instance will prevent the animation from updating. (15)

    Modifying the transform point in a tween can produce unexpected results. (4)

    Content with both Bitmaps and Buttons may generate local security errors in some browsers if run from the local file system."

     

    kglad
    Community Expert
    Community Expert
    February 11, 2021

    warnings are normal but NOTE: your gotoAndStop(7) is actually going to the 8th frame (and gotoAndStop(8) is going to the 9th frame) so make sure those are numbered correctly

     

    open your developer's console and check for errors while testing.

     

    animate has a limit of 16,000 frames in any one timeline.  (and a limit of 16,000 timelines).

     

    for a web app, you can use unity (publishing for webgl) but i don't see any advantages over animate.  for a mobile app, unity makes more sense and i changed from animate to unity for mobile apps when adobe stopped development of air: c# is similar to as3 which is similar to javascript.