Advertisement
Guest User

voter96

a guest
Mar 14th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package {
  2. import flash.events.*;
  3. import flash.display.MovieClip;
  4. import flash.media.*;
  5. import fl.motion.easing.Back;
  6.  
  7.  
  8. public class Rotating extends MovieClip{
  9.  
  10.  
  11. //class variables
  12. var leftKeyPush, rightKeyPush: Boolean = false;
  13.  
  14.  
  15.  
  16. public function rotate() {
  17. // constructor code
  18.  
  19.  
  20. stage.addEventListener(KeyboardEvent.KEY_DOWN, pressKey);
  21. stage.addEventListener(KeyboardEvent.KEY_UP, releaseKey);
  22.  
  23.  
  24. function pressKey(k:KeyboardEvent){
  25. switch (k.keyCode){
  26. case(37) : leftKeyPush = true; break;
  27. case(39) : rightKeyPush = true;
  28. }
  29. }//end of pressKey
  30.  
  31. function releaseKey(k:KeyboardEvent){
  32. switch(k.keyCode){
  33. case(37) : leftKeyPush = false; break;
  34. case(39) : rightKeyPush = false;
  35. }
  36. }//end of releaseKey
  37.  
  38. function rotateStage(e:Event){
  39. trace("k");
  40. if(leftKeyPush) World.rotation = 90;
  41. if(rightKeyPush) World.rotation = -90;
  42.  
  43. }
  44.  
  45.  
  46. }//end of actionscript class
  47.  
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement