Our concepting portfolio

3D Rotation in ActionScript 3.0

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

First create a rectangular shape with a dynamic text field on top. Add the instance variable "mtxt" to the text field. Change the whole graphic into a movie clip and set the linkage to "MyClip". We're done, next is the coding to dynamically add text and rotate the shape.

//Copyright by CreativeReform.com
//Developed by Don Le - contact: donle21@yahoo.com
//Feel free to use any portion of the code
//I will be greatly appreciated if CreativeReform.com is part of the credit or linked to.

package{

import flash.display.MovieClip;
import flash.utils.*;
import flash.display.Stage;


public class Rotation3d extends MovieClip{
public var clip:MyClip;
private var myInterval:uint;
private var myID:uint;
public function Rotation3d():void{
clip = new MyClip();
with(clip){
x = this.stage.stageWidth/2;
y = this.stage.stageHeight/2;
clip.mtxt.text = "CreativeReform.com \nPhasellus malesuada sem rhoncus ante pretium suscipit. Aliquam suscipit mi eget nisi interdum pellentesque. Vestibulum ac porttitor enim.";
}
addChild(clip);
myInterval = setInterval(rotate,10);
}

private function rotate():void{
if(clip.rotationY == 400){
myID = 1;
} else if (clip.rotationY == 0){
myID = 0;
}
if(myID == 1){
clip.rotationY -=2;
} else{
clip.rotationY +=2;
}
}
}

}

That's it. Enjoy!

 

DOWNLOAD file in this tutorial >