Easy Back and forth slider setup with tweenlight


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import flash.ui.Mouse;
  2. import com.greensock.*;
  3.  
  4.  
  5. var Clicking:uint=0;
  6. var tab_x = tab.x;
  7.  
  8.  
  9. b1.addEventListener(MouseEvent.CLICK, left);
  10. function left(evet:MouseEvent):void{
  11.  
  12.  
  13. if (Clicking<3) {
  14.  
  15. Clicking++;
  16. trace(Clicking);
  17.  
  18. }
  19.  
  20. TweenLite.to(tab, 1, {x:tab_x + (Clicking * 65)});
  21.  
  22. }
  23.  
  24.  
  25. b2.addEventListener(MouseEvent.CLICK, right);
  26. function right(evet:MouseEvent):void{
  27.  
  28.  
  29. if (Clicking>0) {
  30. Clicking--;
  31. trace(Clicking);
  32.  
  33. }
  34.  
  35. TweenLite.to(tab, 1, {x:tab_x + (Clicking * 65)});
  36.  
  37. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.