Skip to main content
unsworths2335999
New Participant
December 15, 2020
Question

Creating a button with pop up bubble but all other animation stops

  • December 15, 2020
  • 2 replies
  • 266 views

I'm trying to make a button where as you rollover all other animation pauses, and a pop oup box appears from the button... then once rolled off, the animation restarts. Sounds quite simple but it's just not working for me. It seems that the script to stop the animation also stops the button working and the pop up appearing. Please help.

    This topic has been closed for replies.

    2 replies

    JoãoCésar17023019
    Community Expert
    December 15, 2020

    Here is an example of what I understand.

     

    Main JS code:

    var root = this;
    
    stage.enableMouseOver();
    
    root.container.children.forEach(function(button)
    {
    	button.mouseChildren = false;
    });
    
    root.container.on("mouseover", function(e)
    {
    	e.target.gotoAndStop(1);
    	root.stopAllBut(e.target);
    });
    
    root.container.on("mouseout", function(e)
    {
    	e.target.gotoAndStop(0);
    	root.playAll();
    });
    
    root.playAll = function()
    {
    	root.container.children.forEach(function(button)
    	{
    		button.anim.play();
    	});
    };
    
    root.stopAllBut = function(target)
    {
    	root.container.children.forEach(function(button)
    	{
    		if (target !== button)
    			button.anim.stop();
    	});
    };

     

    There are also some other few lines of codes inside of the buttons and anims to control visibility and playback.

     

    FLA / code / source / files:

    adobe/animate cc/html5_canvas/hover_over_buttons at master · joao-cesar/adobe (github.com)

     

    I hope this helps.

     

    Regards,

    JC

    JoãoCésar17023019
    Community Expert
    December 15, 2020

    Hi.

     

    Just to clarify: are the buttons being constantly animated and their animations stop when one of them is under the mouse cursor?

     

    And from this same button that received the rollover/mouse over event a pop-up appears?

     

    Please let us know.

     

    Regards,

    JC

    unsworths2335999
    New Participant
    December 16, 2020

    The different elements are constantly animating... as part of the main timeline and within the individual movie elements... so I need everything to stop animating apart from a pop up bubble, on rollover.