Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import flash.events.*;
- import flash.display.MovieClip;
- import flash.media.*;
- import fl.motion.easing.Back;
- public class Rotating extends MovieClip{
- //class variables
- var leftKeyPush, rightKeyPush: Boolean = false;
- public function rotate() {
- // constructor code
- stage.addEventListener(KeyboardEvent.KEY_DOWN, pressKey);
- stage.addEventListener(KeyboardEvent.KEY_UP, releaseKey);
- function pressKey(k:KeyboardEvent){
- switch (k.keyCode){
- case(37) : leftKeyPush = true; break;
- case(39) : rightKeyPush = true;
- }
- }//end of pressKey
- function releaseKey(k:KeyboardEvent){
- switch(k.keyCode){
- case(37) : leftKeyPush = false; break;
- case(39) : rightKeyPush = false;
- }
- }//end of releaseKey
- function rotateStage(e:Event){
- trace("k");
- if(leftKeyPush) World.rotation = 90;
- if(rightKeyPush) World.rotation = -90;
- }
- }//end of actionscript class
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement