flex4中的3d效果及三维图形的消失点
代码设置如下:
<fx:Script>
<![CDATA[
public function sanwei(event:Event=null):void {
var per:PerspectiveProjection=new PerspectiveProjection();//定义消失点
per.projectionCenter=new Point(toushi.width/2,toushi.height/2); //定义消失点的坐标
toushi.transform.perspectiveProjection=per;//设置要使用的三维图形对象 toushi.rotationX = -45;//对象沿X轴旋转-45°
}
]]>
</fx:Script>
另外还需在头部初始化一下哦:initialize=“sanwei()” 代码中的对象:
<s:HGroup horizontalAlign="center" verticalAlign="bottom" gap="20" width="710" height="130" id="toushi">
</s:HGroup>