SHARE
TWEET

Untitled

a guest Dec 5th, 2018 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //imports
  2. import com.whirled.*;
  3. import flash.events.Event;
  4. import flash.events.TimerEvent;
  5. import flash.utils.Timer;
  6.  
  7.  
  8. var HARVESTDELAY:int = 1000;
  9. var _ctrl:ToyControl;
  10. var _stageTimer:Timer;
  11.  
  12.  
  13.  
  14.  
  15. _ctrl = new ToyControl(this);
  16. _ctrl.addEventListener(ControlEvent.MEMORY_CHANGED, updateTree);
  17. _stageTimer = new Timer(HARVESTDELAY,90);
  18.  
  19.  
  20. updateTree();
  21.  
  22. function updateTree(o :Object = null):void
  23. {
  24.     var memory:Object = _ctrl.getMemory("State","Stage1");
  25.  
  26.     if (String(memory) == "Stage1")
  27.     {
  28.         Tree.gotoAndPlay(1);
  29.     }
  30.     if (String(memory) == "Stage2")
  31.     {
  32.         hitBox.buttonMode = false;
  33.         Tree.gotoAndPlay(2);
  34.  
  35.         _stageTimer.start();
  36.     }
  37.     if (_stageTimer.currentCount == 90)
  38.     {
  39.         if (String(memory) == "Stage3")
  40.         {
  41.             hitBox.buttonMode = true;
  42.             Tree.gotoAndPlay(21);
  43.         }
  44.     }
  45.  
  46. }
  47.  
  48.  
  49.  
  50. function switchState():void
  51. {
  52.    
  53.     var memory:Object = _ctrl.getMemory("State","Stage1");
  54.  
  55.     if (String(memory) == "Stage1")
  56.     {
  57.         _ctrl.setMemory("State","Stage2");
  58.     }
  59.     if (String(memory) == "Stage2")
  60.     {
  61.         _ctrl.setMemory("State","Stage3");
  62.     }
  63.     else if (String(memory) == "Stage3")
  64.     {
  65.         _ctrl.setMemory("State","Stage1");
  66.     }
  67.  
  68. }
  69.  
  70. hitBox.buttonMode = true;
  71. Tree.buttonMode = false;
  72. hitBox.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  73. function mouseDownHandler(event:MouseEvent):void
  74. {
  75.  
  76.     switchState();
  77. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top