# Component Issues

**URL:** <https://forum.kirupa.com/t/component-issues/196763>\
**Category:** flash\
**Created:** [August 10, 2006, 7:50pm UTC](https://forum.kirupa.com/t/component-issues/196763 "2006-08-10T19:50:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jguerilla](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jguerilla](https://forum.kirupa.com/u/jguerilla)\
**Post date:** [August 10, 2006, 7:50pm UTC](https://forum.kirupa.com/t/component-issues/196763/1 "2006-08-10T19:50:00Z")

</div>

I need help changing the code of a component from being just a any keyboard button to the left being left. and the right being right. Here’s the code:  
#initclip  
function drag() {  
// recive the instance name from drag&drop on stage  
var target = this.\_parent[this.\_targetInstanceName];  
var temp = this.ang;  
// cursor changing to hand  
target.useHandCursor = this.showHand;  
target.snapToCenter = this.snapToCenter;  
// keyboard listener definition  
// mouse pressed action  
keyboard = new Object();  
target.onPress = function() {  
// getting the object rotation  
rot = target.\_rotation;  
// keyboard rotation action  
keyboard.onKeyDown = function() {  
rot = rot+temp;  
target.\_rotation = rot;  
};  
Key.addListener(keyboard);  
// drag action  
this.startDrag(this.snapToCenter);  
};  
// smoother move  
target.onmousemove = function() {  
updateAfterEvent();  
};  
target.onmouseup = function() {  
this.stopDrag();  
Key.removeListener(keyboard);  
};  
// hide component icon  
setProperty(this, \_visible, false);  
}  
// rigister  
Object.registerClass(“dragandrotate”, drag);  
#endinitclip

Heres the set of code I have fore the specific keys:

if(Key.getCode()==Key.LEFT){  
this.\_mc.\_rotation++;}  
if(Key.getCode()==Key.RIGHT){  
this.\_mc.\_rotation–;}

If anyone knows what I can do, I would appreciate it  
Thanks
