Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

infinite button unbind/bind loop

$
0
0

Hello everyone,

 

I have two buttons. The click-event unbinds the click-event from the button which was clicked. when i click the other button, i rebind the events to the first button. This works one time only. When i bind the click event with a secound "loop" i can get it work 2 times, and so on. How can i make it easy and infinite ?

 

here is my code:

 

// click event button1

sym.getSymbol("Produktionen").play("click");

sym.$("Produktionen").unbind("mouseover");

sym.$("Produktionen").unbind("mouseout");

sym.$("Produktionen").unbind("click");

 

 

// check for status of button2. If button2 had been clicked, all events have been unbound on button2. Then rebind of all events for button2

if (sym.getSymbol("Personen").getPosition() > 5000) {

 

// binding of the click event for button2. here comes my problem with the loop.

      sym.$("Personen").bind("click",function(){

      sym.getSymbol("Personen").play("click");

      sym.$("Personen").unbind("mouseover");

      sym.$("Personen").unbind("mouseout");

      sym.$("Personen").unbind("click");

 

// mouseover bind for button2

      sym.$("Personen").bind("mouseover",function(){

      sym.getSymbol("Personen").play("over");

      });

 

// mousout bind for button2

      sym.$("Personen").bind("mouseout",function(){

      sym.getSymbol("Personen").play("out");

      });

 

// mousout animation is triggert for button2.

     sym.getSymbol("Personen").play("out")

 

}

 

hope someone understands my problem


Viewing all articles
Browse latest Browse all 9897

Trending Articles