# Question about delayed drawing with API

[COLOR=black][FONT=Arial]Hey everybody, got a question I was hoping someone could help me out with. I’ve created a Rubik’s Cube in 3d using some math references and tutorials and general computer science knowledge and have gotten to the point where I’m making things pretty.[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]My question is how to make a function that is independent from the timeline draw the screen, pause for a split second, and draw again… repeatedly. I have a function that rotates an individual row of the cube at an angle… ex( rubix.zPos(PI/8)… [/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]My movie consists of two frames… frame one sets everything up, and frame two just loops. I use listeners and onEnterFrames to control movement etc.[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]When I do the rotation though it happens instantly. I’d like there to be a gradual rotation… say stepping through the rotation of one side so it takes a full second to do a 90degree turn. I can’t seem to make anything work… here’s the code that currently rotates the cubes(stored in a 3x3x3 matrix)…[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]

``````[/FONT][/COLOR]
[COLOR=black][FONT=Arial]public function zPos() {
for (var i = 0; i<3; i++) {
for (var j = 0; j<3; j++) {
for (var k = 0; k<3; k++) {
cubePositions*[j][1].zPos(PI/8);
}
}
}
}[/FONT][/COLOR]
[COLOR=black][FONT=Arial]
``````

[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]The cubes in each position receive the command to rotate their coordinates making the row turn. I thought of having an additional loop that waits something small like .1 seconds and then continues but I’ve been unable to do it. When the cube is done rotating it automatically redraws.[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]Any ideas? Thanks for the help![/FONT][/COLOR]