0 members and 4,881 guests
No Members online

» Site Navigation
» Stats
Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
|
-
Menu / help
http://img252.imageshack.us/my.php?image=menuqb3.swf
Thoughts?
Plus does anyone know how to make each face of the square in to a link other scenes
Code:
this.createEmptyMovieClip("theScene", 1);
theScene._x = 275;
theScene._y = 175;
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)
{
var point = new Object();
point.x = x;
point.y = y;
return point;
}
;
isVisibleBetween = function (a, b, c)
{
if ((b.y - a.y) / (b.x - a.x) < (c.y - a.y) / (c.x - a.x) ^ a.x < b.x == a.x > c.x)
{
return true;
return;
}
return false;
}
;
drawFilledSquare = function (a, b, c, d)
{
this.clear();
this.lineStyle(2, 0, 100);
if (isVisibleBetween(a, b, c))
{
this.moveTo(a.x, a.y);
this.beginFill(this.col, 100);
this.lineTo(b.x, b.y);
this.lineTo(c.x, c.y);
this.lineTo(d.x, d.y);
this.lineTo(a.x, a.y);
this.endFill();
}
}
;
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;
var y;
var z;
var xy;
var xz;
var yx;
var yz;
var zx;
var zy;
var scaleRatio;
var i = points.length;
while (i--)
{
x = points[i].x;
y = points[i].y;
z = points[i].z;
xy = cx * y - sx * z;
xz = sx * y + cx * z;
yz = cy * xz - sy * x;
yx = sy * xz + cy * x;
zx = cz * yx - sz * xy;
zy = sz * yx + cz * xy;
scaleRatio = focalLength / (focalLength + yz);
x = zx * scaleRatio;
y = zy * scaleRatio;
TransformedPointsArray[i] = make2DPoint(x, y);
}
return TransformedPointsArray;
}
;pointsArray = [make3DPoint(-60, -60, -60), make3DPoint(60, -60, -60), make3DPoint(60, -60, 60), make3DPoint(-60, -60, 60), make3DPoint(-60, 60, -60), make3DPoint(60, 60, -60), make3DPoint(60, 60, 60), make3DPoint(-60, 60, 60)];
rollOverFace = function ()
{
this.col = 0xff3CECFF;
display_txt.text = "Section: "+this._name;
}
;
pressFace = function ()
{
this.col = 0xff33CCFF
;
}
;
rollOutFace = function ()
{
this.col = 0xffE1E1E1;
}
;
for (i = 0; i<6; i++){
emptyFace = theScene.createEmptyMovieClip("face" + i, i);
emptyFace.col = 0xffE1E1E1;
emptyFace.onRollOver = emptyFace.onDragOver = rollOverFace;
emptyFace.onRollOut = emptyFace.onDragOut = rollOutFace;
emptyFace.onPress = pressFace;
emptyFace.draw = drawFilledSquare;
}
cubeAxisRotations = make3DPoint(0, 0, 0);
rotateCube = function ()
{
cubeAxisRotations.y = cubeAxisRotations.y - this._xmouse / 2800;
cubeAxisRotations.x = cubeAxisRotations.x + this._ymouse / 2800;
var pts2D = Transform3DPointsTo2DPoints(pointsArray, cubeAxisRotations);
this.face0.draw(pts2D[0], pts2D[3], pts2D[2], pts2D[1]);
this.face1.draw(pts2D[4], pts2D[5], pts2D[6], pts2D[7]);
this.face2.draw(pts2D[0], pts2D[4], pts2D[7], pts2D[3]);
this.face3.draw(pts2D[3], pts2D[7], pts2D[6], pts2D[2]);
this.face4.draw(pts2D[2], pts2D[6], pts2D[5], pts2D[1]);
this.face5.draw(pts2D[1], pts2D[5], pts2D[4], pts2D[0]);
}
;
theScene.onEnterFrame = rotateCube;
-
sorry i dont know. 
But i like to play with it 
nice work..
but i think you can find tutorial for your ask in http://www.good-tutorials.com/tutorials/flash
Similar Threads
-
By undertone in forum Digital Art
Replies: 11
Last Post: 04-18-2007, 01:27 PM
-
By Nightfire in forum The Void
Replies: 6
Last Post: 05-24-2006, 08:36 AM
-
By Nightfire in forum The Void
Replies: 10
Last Post: 03-13-2006, 04:09 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|