Hi all, been working thru the tutorials and ive been pretty successful with most of them up until now, when trying the tute from this url
http://www.kirupa.com/developer/actionscript/faces_depths.htm
Nothing appears when i goto test the movie, any ideas? heres the actionscript code im working with - is this right? is this what is meant to be in place? some of it is included from previous tutorials in the chapter
this.createEmptyMovieClip(“theScene”, 1);
theScene._x = 150;
theScene._y = 150;
focalLength = 300;
make3DPoint = function(x,y,z){
var point = new Object();
point.x = x;
point.y = y;
point.z = z;
return point;
};
make2DPoint = function(x,y, depth, scaleFactor){
var point = new Object();
point.x = x;
point.y = y;
point.depth = depth;
point.scaleFactor = scaleFactor;
return point;
};
Transform3DPointsTo2DPoints = function(points, axisRotations){
var TransformedPointsArray = [];
var sx = Math.sin(axisRotations.x);
var cx = Math.cos(axisRotations.x);
var sy = Math.sin(axisRotations.y);
var cy = Math.cos(axisRotations.y);
var sz = Math.sin(axisRotations.z);
var cz = Math.cos(axisRotations.z);
var x,y,z, xy,xz, yx,yz, zx,zy, scaleFactor;
var i = points.length;
while (i--){
x = points*.x;
y = points*.y;
z = points*.z;
// rotation around x
xy = cx*y - sx*z;
xz = sx*y + cx*z;
// rotation around y
yz = cy*xz - sy*x;
yx = sy*xz + cy*x;
// rotation around z
zx = cz*yx - sz*xy;
zy = sz*yx + cz*xy;
scaleFactor = focalLength/(focalLength + yz);
x = zx*scaleFactor;
y = zy*scaleFactor;
z = yz;
TransformedPointsArray* = make2DPoint(x, y, -z, scaleFactor);
}
return TransformedPointsArray;
};
pointsArray = [
make3DPoint(-50,-50,-50),
make3DPoint(50,-50,-50),
make3DPoint(50,-50,50),
make3DPoint(-50,-50,50),
make3DPoint(-50,50,-50),
make3DPoint(50,50,-50),
make3DPoint(50,50,50),
make3DPoint(-50,50,50)
];
for (i=0; i < pointsArray.length; i++){
attachedObj = theScene.attachMovie(“redballoon”, “redballoon”+i, i);
}
cubeAxisRotations = make3DPoint(0,0,0);
rotateCube = function(){
cubeAxisRotations.y -= this._xmouse/3000;
cubeAxisRotations.x += this._ymouse/3000;
var screenPoints = Transform3DPointsTo2DPoints(pointsArray, cubeAxisRotations);
for (i=0; i < pointsArray.length; i++){
currBalloon = this[“balloon”+i];
currBalloon._x = screenPoints*.x;
currBalloon._y = screenPoints*.y;
currBalloon._xscale = currBalloon._yscale = 100 * screenPoints*.scaleRatio;
currBalloon.swapDepths(screenPoints*.depth);
}
};
theScene.onEnterFrame = rotateCube;