Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.events.Event;
- import flash.system.fscommand;
- import fl.motion.easing.Linear;
- import flash.text.TextField;
- // Variables
- var list:Array = new Array();
- var itemList:Array = new Array();
- // Buttons
- candy_Button.addEventListener(MouseEvent.CLICK, candy); // Candy button
- logoff_Button.addEventListener(MouseEvent.CLICK, logoff); // Log off button
- // Example of how to remove commas on array.
- //list_text.text = String(list.join("\n"));
- // Button functions
- // Purple buttons function
- // Candy function
- function candy(e:MouseEvent){
- var candyrandom = Math.floor(Math.random()*(5000-10));
- var candyprice = Math.floor(10.9 * (candyrandom / 100));
- list.push(candyprice);
- addline(candyrandom);
- //list_text.text = String(list.join("\n"));
- }
- // Log off but
- function logoff(e:MouseEvent){
- fscommand("quit");
- }
- function moveList():void {
- for (var i = 0; i < itemList.length; i++){
- itemList[i].y += 18;
- if (itemList[i].y > 1000){
- removeChild(itemList[i-1]);
- itemList[i-1] = null;
- itemList.splice(i-1,1);
- }
- } }
- function addline(amount){
- var line:TextField = new TextField();
- line.x = 100;
- line.y = 170;
- line.text = amount;
- itemList.push(line);
- moveList();
- addChild(line);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement