# Adapting rotating images script to use keytrokes instead of \_xmouse

**URL:** <https://forum.kirupa.com/t/adapting-rotating-images-script-to-use-keytrokes-instead-of--xmouse/200824>\
**Category:** Uncategorized\
**Created:** [September 15, 2006, 2:43pm UTC](https://forum.kirupa.com/t/adapting-rotating-images-script-to-use-keytrokes-instead-of--xmouse/200824 "2006-09-15T14:43:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![diemster](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@diemster](https://forum.kirupa.com/u/diemster)\
**Post date:** [September 15, 2006, 2:43pm UTC](https://forum.kirupa.com/t/adapting-rotating-images-script-to-use-keytrokes-instead-of--xmouse/200824/1 "2006-09-15T14:43:38Z")

</div>

The script works fine but it works on mouse movements. I want to control it by the keys “left” and right". The problem lies is the "\_xmouse " it should take it variables from the keys left and right.  
I attached the fla to it, so you see I was trying to add the key left and right to it…

Who can help me???

-------org script----------

imagelist = [“images/01.jpg”, “images/02.jpg”, “images/03.jpg”, “images/04.jpg”, “images/05.jpg”, “images/06.jpg”, “images/07.jpg”, “images/01.jpg”], “images/01.jpg”]

MovieClip.prototype.rotation\_menu = function (imageList, posX, posY, alpha, focus, posZ, radius, loading, turnfactor)  
{  
var angle = 0;  
var images = [];  
var pi = 2 \* Math.PI;  
var image, dimension, piangle;  
var xfactor = 300;

this.\_x = posX;  
this.\_y = posY;  
this.\_alpha = alpha;

for (var i = 0; i \< imageList.length; i++)  
{  
image = this.attachMovie (“loadingclips”, “image” + i, i);  
image.wphase = pi / imageList.length \* i;  
image.container.loadMovie (imageList\*);  
if (loading == false) image.window.\_visible = 0;  
images.push (image);  
}  
this.onEnterFrame = function ()  
{  
xfactor =\_root.keyposX;

angle += center.\_xmouse / turnfactor;

if (angle \>= pi) angle -= pi;  
if (angle \< 0) angle += pi;

for (var i = 0; i \< images.length; i++)  
{  
image = images\*;  
image.x = radius \* Math.cos (image.wphase + angle);  
image.z = radius \* Math.sin (image.wphase + angle) + posZ;  
dimension = focus / image.z;  
piangle = Math.atan2 (image.x, image.z);  
image.\_x = image.x \* dimension;  
image.\_xscale = -100 \* dimension \* Math.sin (image.wphase + angle + piangle);  
image.\_yscale = 100 \* dimension;  
image.swapDepths (-(int (image.z)));  
}  
};  
}  
// imageList, posX, posY, alpha, focus, posZ, radius, loading, turnfactor  
center.rotation\_menu (imagelist, Stage.width/2, Stage.height/2, 100, 600, 600, 200, true, 8000);
