Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import flash.events.Event;
  2. import com.whirled.AvatarControl;
  3.  
  4. if (_ctrl == null) {
  5. _ctrl = new AvatarControl(this);
  6. _body = new Body(_ctrl, this, 550);
  7. _ctrl.setHotSpot(269, 399);
  8. _ctrl.addEventListener(Event.UNLOAD, handleUnload);
  9. function handleUnload (... ignored) :void {
  10. _body.shutdown();
  11. }
  12. }
  13.  
  14. var _ctrl :AvatarControl;
  15. var _body :Body;
  16.  
  17. import com.whirled.ControlEvent;
  18.  
  19. _ctrl.addEventListener(ControlEvent.STATE_CHANGED, stateChanged);
  20.  
  21. function stateChanged(event:ControlEvent):void {
  22. switch(event.name) {
  23. case "Run":
  24. _ctrl.setMoveSpeed(250);
  25. break;
  26.  
  27. default:
  28. _ctrl.setMoveSpeed(150);
  29. break;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement