So far I've been able to understand pretty much what it does and how it works, but actionscript is another unfamiliar area for me. Flash itself I can work with the basics, nothing fancy.

The result I'm looking for is a 3D pyramid that rotates only on the y axis as you pan your mouse back and forth. So the above tutorial has gotten me to that point with the script adjustments I have attached.

Where I need help now is the coloring of the pyramid. Rather than color it with solid colors in the script - I need to be able to assign each side of the pyramid with a graphic and text.

I use Sothink SWF Quicker (do have Flash CS3, but find it overly confusing). Sothink is very similar and uses the same actionscript features, so I don't think it will be a huge problem giving me a hand even you're not familiar with Sothink. I should be able to make the comparison.

Any help is greatly appreciated. Even a better starter tutorial with source code would be fine if it's closer to the end result I need.

this.createEmptyMovieClip("scene2", 2);scene2._x = 150;scene2._y = 150;focalLength = 300;isVisibleBetween = function (a, b, c){ var _loc1 = a; var _loc2 = c; var _loc3 = b; if ((_loc3.y - _loc1.y) / (_loc3.x - _loc1.x) - (_loc2.y - _loc1.y) / (_loc2.x - _loc1.x) < 0 ^ _loc1.x <= _loc3.x == _loc1.x > _loc2.x) { return (true); } else { return (false); } // end else if};make3DPoint = function (x, y, z){ var _loc1 = new Object(); _loc1.x = x; _loc1.y = y; _loc1.z = z; return (_loc1);};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 _loc3; var _loc2; var xy; var xz; var yx; var yz; var zx; var zy; var scaleRatio; var _loc1 = points.length; while (_loc1--) { x = points[_loc1].x; _loc3 = points[_loc1].y; _loc2 = points[_loc1].z; xy = cx * _loc3 - sx * _loc2; xz = sx * _loc3 + cx * _loc2; 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; _loc3 = zy * scaleRatio; _loc2 = -yz; TransformedPointsArray[_loc1] = make3DPoint(x, _loc3, _loc2); } // end while return (TransformedPointsArray);};pointsArray = [make3DPoint(-50, 29, 29), make3DPoint(0, 29, -58), make3DPoint(50, 29, 29), make3DPoint(0, -58, 0)];scene2.pyramidAxisRotations = make3DPoint(0, 0, 0);scene2.createEmptyMovieClip("face1", 1);scene2.createEmptyMovieClip("face2", 2);scene2.createEmptyMovieClip("face3", 3);scene2.createEmptyMovieClip("face4", 4);rotatePyramid2 = function (){ this.pyramidAxisRotations.y = this.pyramidAxisRotations.y - this._xmouse / 2000; //this.pyramidAxisRotations.x = this.pyramidAxisRotations.x + this._ymouse / 2000; var pts2D = Transform3DPointsTo2DPoints(pointsArray, this.pyramidAxisRotations); var mouseIsDown = Key.isDown(1); with (this.face1) { clear(); lineStyle(2, 0, 100); if (!mouseIsDown) { beginFill(8388608, 100); } // end if moveTo(pts2D[0].x, pts2D[0].y); lineTo(pts2D[1].x, pts2D[1].y); lineTo(pts2D[2].x, pts2D[2].y); lineTo(pts2D[0].x, pts2D[0].y); endFill(); swapDepths((pts2D[0].z + pts2D[1].z + pts2D[2].z) / 3); } // End of with with (this.face2) { clear(); lineStyle(2, 0, 100); if (!mouseIsDown) { beginFill(32768, 100); } // end if moveTo(pts2D[0].x, pts2D[0].y); lineTo(pts2D[1].x, pts2D[1].y); lineTo(pts2D[3].x, pts2D[3].y); lineTo(pts2D[0].x, pts2D[0].y); endFill(); swapDepths((pts2D[0].z + pts2D[1].z + pts2D[3].z) / 3); } // End of with with (this.face3) { clear(); lineStyle(2, 0, 100); if (!mouseIsDown) { beginFill(128, 100); } // end if moveTo(pts2D[1].x, pts2D[1].y); lineTo(pts2D[2].x, pts2D[2].y); lineTo(pts2D[3].x, pts2D[3].y); lineTo(pts2D[1].x, pts2D[1].y); endFill(); swapDepths((pts2D[1].z + pts2D[2].z + pts2D[3].z) / 3); } // End of with with (this.face4) { clear(); lineStyle(2, 0, 100); if (!mouseIsDown) { beginFill(8421376, 100); } // end if moveTo(pts2D[2].x, pts2D[2].y); lineTo(pts2D[0].x, pts2D[0].y); lineTo(pts2D[3].x, pts2D[3].y); lineTo(pts2D[2].x, pts2D[2].y); endFill(); swapDepths((pts2D[2].z + pts2D[0].z + pts2D[3].z) / 3); } // End of with};scene2.onEnterFrame = rotatePyramid2;

While it's possible to do this in AS2, it's not easy to achieve what you want easily. This is because there is no 3D support in AS2.

Luckily, there is this library called PaperVision3D, use it and you will be able to achieve what you want pretty easily. Though I suggest you to use AS3 instead, makes things a whole lot easier.

0

Featured Post

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Luckily, there is this library called PaperVision3D, use it and you will be able to achieve what you want pretty easily. Though I suggest you to use AS3 instead, makes things a whole lot easier.