Actionscript 3 3D with Flash CS4
Wednesday, November 26th, 2008I finally got a copy of adobe flash cs4. In addition to the great new user interface flash cs4 can compile flashplayer 10 content which enables the new actionscript 3 3D methods. with only the three simply rotationX, rotationY and rotationZ properties one can quickly create really nice 3D animations. This is my first test.
here are the few lines of code it took to make this thing spin:
</pre>
import flash.display.*
import flash.geom.*
import flash.events.*
import flash.display.*
var panes:MovieClip=new MovieClip()
panes.x=300
panes.y=200
for(var i:Number=0;i<18;i++){
var pane:MovieClip=new MovieClip()
pane.graphics.lineStyle(1,0xffffff,0.5)
pane.graphics.beginFill(0x003366,0.3)
pane.graphics.drawRect(0,0,100,100)
pane.x=0
pane.y=-50
pane.rotationY=i*20
pane.moving=false
panes.addChild(pane)
}
addChild(panes)
panes.rotationZ=90
panes.cacheAsBitmap=true
panes.addEventListener(Event.ENTER_FRAME,movePanes)
function movePanes(e:Event){
panes.rotationX+=5
}
<pre>