Web Design Resources & Tutorials to help you design the best website!
Here is an Example of How you can use the Flash Player 10 API to make a 3D cube in Flex.
If someone knows how to solidify the colors so it does not look see thru let me know.
?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()" paddingTop="20" width="450" height="450"> <mx:Script> <![CDATA[ import mx.core.FlexShape; import mx.core.UIComponent; import mx.core.FlexBitmap; import __AS3__.vec.Vector; /** * @private * The Cube Holder */ private var myCubeHolder:UIComponent = new UIComponent(); /** * @private */ private var cubeFaces:Vector.<FlexShape> = new Vector.<FlexShape>(6); private function onCreationComplete():void { addChild(myCubeHolder); myCubeHolder.x = myCubeHolder.y=250; createCubeFaces(); myCubeHolder.addEventListener(Event.ENTER_FRAME,onCubeHolderFrame); } private function onCubeHolderFrame(event:Event):void { myCubeHolder.rotationX+=1; myCubeHolder.rotationY+=1; } /** * @Private * We use this function to create the faces of the cube * which will be 6 */ private function createCubeFaces():void { for(var i:int=0;i<6;i++) { cubeFaces[i] = new FlexShape(); cubeFaces[i].graphics.beginFill(Math.random()*0xFFFFFF,1); cubeFaces[i].graphics.drawRect(-100,-100,100,100); cubeFaces[i].graphics.endFill(); cubeFaces[i].blendMode = BlendMode.DARKEN; myCubeHolder.addChild(cubeFaces[i]); } cubeFaces[0].z=100; cubeFaces[1].rotationY=90; cubeFaces[2].rotationX=-90; cubeFaces[3].rotationY=90; cubeFaces[3].x=-100; cubeFaces[4].rotationX=90; cubeFaces[4].y=-100; cubeFaces[4].z=100; //we do nothing with cubeFace[5] since it is already //in its place } ]]> </mx:Script> </mx:Application>