Asked By
Adams Baker
60 points
N/A
Posted on - 09/28/2012
I want create 3 D pyramid (ex. planets in space simulators) using AS 3 code so I could have the flexibility to scale up or down the complexity of the model on a whim. So what are the steps needed to make 3 D pyramid in AS 3 code?
Steps needed to make 3D pyramid in AS3 code
To make a pyramid in as3 code, follow the steps:
1. Import flash display Shape
2. Find Shape. Select new shape addChild
3. Select drawChart to (300, 300, 200, 350, 40);
4. Input Height, input Base, input baseCenter, and baseCenterY to your desired number, change closure to void. myChart.graphics to clear, make lineStyle (1, 0x444444) in the box.
5. Do the following inputs one after another-
A. Make BeginFill to (0xD7FFD4); myChart.graphics move To(baseCenterX-theBase/2, baseCenterY);
B. myChart.graphics. lineTo(baseCenterX, baseCenterY +closure);
C. myChart.graphics. lineTo(baseCenterX, baseCenterY – theHeight); myChart.graphics. lineTo(baseCenterX-theBase/2, baseCenterY); myChart.graphics.endFill
D. myChart.graphics. beginFill(0xB1EEAC); myChart.graphics. moveTo(baseCenterX+theBase/2, baseCenterY);
E. Chart.graphics. lineTo(baseCenterX, baseCenterY +closure); myChart.graphics. lineTo(baseCenterX, baseCenterY – theHeight);
F. myChart.graphics. lineTo(baseCenterX+theBase/2, baseCenterY);
G. myChart.graphics.endFill(); }
6. Now, our drawChart has 5 parameters – height of our pyramid, base of our pyramid, the coordinates for the center of the base, and a closure value.
***The values can be changed to whatever you like, the pyramid will be drawn automatically according to your values.
Hope these shall help you.
Thanks.