Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. import flash.events.Event;
  3. import flash.system.fscommand;
  4. import fl.motion.easing.Linear;
  5. import flash.text.TextField;
  6.  
  7. // Variables
  8. var list:Array = new Array();
  9. var itemList:Array = new Array();
  10. // Buttons
  11. candy_Button.addEventListener(MouseEvent.CLICK, candy); // Candy button
  12. logoff_Button.addEventListener(MouseEvent.CLICK, logoff); // Log off button
  13.  
  14. // Example of how to remove commas on array.
  15. //list_text.text = String(list.join("\n"));
  16.  
  17. // Button functions
  18. // Purple buttons function
  19.  
  20. // Candy function
  21. function candy(e:MouseEvent){
  22.  
  23. var candyrandom = Math.floor(Math.random()*(5000-10));
  24. var candyprice = Math.floor(10.9 * (candyrandom / 100));
  25.  
  26. list.push(candyprice);
  27. addline(candyrandom);
  28. //list_text.text = String(list.join("\n"));
  29. }
  30.  
  31.  
  32. // Log off but
  33. function logoff(e:MouseEvent){
  34. fscommand("quit");
  35. }
  36.  
  37. function moveList():void {
  38. for (var i = 0; i < itemList.length; i++){
  39. itemList[i].y += 18;
  40. if (itemList[i].y > 1000){
  41. removeChild(itemList[i-1]);
  42. itemList[i-1] = null;
  43. itemList.splice(i-1,1);
  44. }
  45. } }
  46.  
  47. function addline(amount){
  48.  
  49. var line:TextField = new TextField();
  50. line.x = 100;
  51. line.y = 170;
  52. line.text = amount;
  53. itemList.push(line);
  54. moveList();
  55. addChild(line);
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement