Guest User

Untitled

a guest
Apr 26th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. /**
  2. *
  3. *
  4. * Lunette
  5. *
  6. * @author Didier Brun
  7. * @version 1.0
  8. *
  9. */
  10.  
  11. package {
  12. import flash.display.Sprite;
  13. import flash.events.Event;
  14. import flash.events.KeyboardEvent;
  15. import flash.ui.Keyboard;
  16.  
  17. public class Lunette extends Sprite {
  18.  
  19. // ------------------------------------------------
  20. //
  21. // ---o properties
  22. //
  23. // ------------------------------------------------
  24.  
  25. public var tourelleh : TourelleHorizontale;
  26.  
  27. // ------------------------------------------------
  28. //
  29. // ---o constructor
  30. //
  31. // ------------------------------------------------
  32.  
  33. function Lunette(){
  34. addEventListener(Event.ADDED_TO_STAGE, init);
  35. }
  36.  
  37. // ------------------------------------------------
  38. //
  39. // ---o public methods
  40. //
  41. // ------------------------------------------------
  42.  
  43. // ------------------------------------------------
  44. //
  45. // ---o private methods
  46. //
  47. // ------------------------------------------------
  48.  
  49. /**
  50. * init
  51. */
  52. private function init(e:Event):void{
  53. stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
  54. }
  55.  
  56. /**
  57. * key down
  58. */
  59. private function keyDown(e : KeyboardEvent) : void {
  60. switch (e.keyCode){
  61. case Keyboard.UP:
  62. tourelleh.clic(1);
  63. break;
  64. case Keyboard.DOWN:
  65. tourelleh.clic(-1);
  66. break;
  67. }
  68. }
  69. }
  70. }
Add Comment
Please, Sign In to add comment