Posted By

jaredyeo on 09/09/10


Tagged

slots jackpot


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bobbym245


Simple jackpot slot machine script


 / Published in: ActionScript 3
 

URL: http://simplistika.com/jackpot-slots/

  1. import flash.utils.Timer;
  2. import flash.events.TimerEvent;
  3.  
  4. var xTime : int = 0;
  5. var xCount : int = 100;
  6. var xHalf : int = xCount / 2;
  7. var xTimer : Timer;
  8.  
  9. xTimer = new Timer(10);
  10. xTimer.addEventListener(TimerEvent.TIMER, xfOnTimer, false, 0, true);
  11. xTimer.start();
  12.  
  13. function xfOnTimer(e : TimerEvent) : void
  14. {
  15. xCount--;
  16.  
  17. // for the dramatic finish
  18. if (xCount < 2)
  19. xTime += 4000;
  20. else if (xCount < 5)
  21. xTime += 200
  22. else if (xCount < 10)
  23. xTime += 100;
  24. else if (xCount < 50)
  25. xTime += 10
  26.  
  27. // frame changing
  28. if (mcContent.currentFrame == mcContent.totalFrames)
  29. mcContent.gotoAndStop(1);
  30. else
  31. mcContent.nextFrame()
  32.  
  33. // new interval
  34. xTimer.stop();
  35. if (xCount != 1)
  36. {
  37. xTimer = new Timer(xTime);
  38. xTimer.addEventListener(TimerEvent.TIMER, xfOnTimer, false, 0, true);
  39. xTimer.start();
  40. }
  41. }

Report this snippet  

You need to login to post a comment.