gt_X_lt  
                
               
                 
              
                  
                    September 23, 2004,  9:59pm
                   
                   
              1 
               
             
            
              I would like to be able to rotate a movieclip by 45 degrees each time i press left or right.
I have got this
on (keyPress "<Right>") {
 _rotation=+45
}
on (keyPress "<Left>") {
 _rotation=-45
}
 
However, this moves the movie clip to the point of 45 degrees or minus 45 degrees depending on the key pressed.
I would like to add +45 to the rotation when i press the right key and -45 when i press the left key.
What have i done wrong. Please can you help me?
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    September 24, 2004,  3:42am
                   
                   
              3 
               
             
            
              on (keyPress "<Right>") {
 _rotation +=45
}
on (keyPress "<Left>") {
 _rotation-=45
}
 
note tha you have placed + & =  in the wrong way
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    September 24, 2004,  8:25am
                   
                   
              4 
               
             
            
              Just so i fully understand.
= 45 means rotate to 45 degrees.
+= 45 Means add 45 degrees to the current rotation. 
-= 45 means minus 45 degrees to the current rotation.
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    September 24, 2004, 11:45am
                   
                   
              5 
               
             
            
              Yes, ‘=’ will set a value, ‘+=’ will increase by value and ‘-=’ will decrease by value.
             
            
               
               
               
            
            
           
          
            
              
                system  
                
               
              
                  
                    September 24, 2004, 11:53am
                   
                   
              6 
               
             
            
              Just as another option (less efficient) you could also have used 
rotation = rotation+45; 
that’s the long hand for the += operator.
There are two more shorthand operators like this, the decrementation operator and incrementation operator 
variable–; //subtracts one from the variable 
vairable++; //adds one to the variable