Flash CS5 3D立方体中心点不起作用

时间:2012-09-12 19:33:17

标签: flash actionscript 3d flash-cs5 cs4

我正在使用下面的操作脚本来旋转我的多维数据集。

即使我把它设置在中间,我怎么会遇到从错误的中心点旋转的问题。

我知道这可以使用动作脚本来完成,只是想知道语法或任何简单的建议。

function cubeRotate(e:Event){
    mycube3d.rotationY = mycube3d.rotationY+1;
    mycube3d.rotationX = mycube3d.rotationX+1;

}
stage.addEventListener(Event.ENTER_FRAME,cubeRotate);

2 个答案:

答案 0 :(得分:0)

如果您尝试通过拖动白色圆圈来更改Flash IDE中的“中心点” - 请尝试  将“mycube3d”(或其内容)包含在另一部电影中并将其移到内部以设置所需的中心

因为.rotationY会围绕零坐标旋转对象并忽略ide的中心设置。

答案 1 :(得分:0)

setRegPoint(book, book.width / 2, book.height / 2);

function setRegPoint(obj:DisplayObjectContainer, newX:Number, NewY:Number):void {

    var bounds:Rectangle = obj.getBounds(obj.parent);
    var currentRegZ:Number = obj.z - bounds.top;

    var zOffset:Number = -50 - currentRegZ;

    obj.z += zOffset;

    for(var i:int = 0; i < obj.numChildren; i++) {
        obj.getChildAt(i).z -= zOffset;
    }
}

function cubeRotate(e:Event){    
  book.rotationY = book.rotationY+1    
  book.rotationX = book.rotationX+1    
}

stage.addEventListener(Event.ENTER_FRAME,cubeRotate)