First, with transform panel
We take positive Pentagon as an example
1, create a new file, in the scene to draw a straight line, press F8 into the film, the center as the upper left corner, as shown in Figure 1
Figure 1: The center is set in the upper left corner
2, select the line, press Ctrl+t to pull out the transform panel, and in the Rotate box to enter 72 (360/5), the angle of calculation is 360 degrees divided by the number of edges. As shown in Figure 2
Figure 2:transform Panel
3, press the copy of the Panel and apply Transform button 4 times, you can copy out of the ring arranged four lines
4, press CTRL + A to select all the straight line, according to Ctrl+b scattered, in turn, the end of the line connection, remove the excess line is completed. As shown in Figure 3.
Figure 3: Positive Pentagon
Second, with AS
The interface, as shown in the following illustration, is concise, with two input text boxes and a button
You just enter the number of edges and sizes in the text box, press the OK button, you can draw the polygon you want, the following we will make a step-by-step.
1, start flash, press CTRL + N to create a new file, scene size and background set reasonable can be, press Ctrl+s save, file name is polygon.
2, press the T key to select the Text tool, and open the property panel, the following figure to select the input text,
Drag a text box in the upper-left corner of the scene, as the number of sides of the polygon, or enter BB in the Var bar in the property panel, and take a variable name for the text box to make it easier to call the program later. Using the same method to make another text box, named AA, as the size of the polygon.
3. Draw a small square in the scene and select it, press F8 to convert to a button,
4, and finally add as for the button, as follows:
Train of thought: divide a circle into n equal parts, connect these dots, such as the right diagram how to draw Pentagon
On (release)//mouse is released by executing the following statement { daxiao=aa; Gets the size of the polygon from the text box entered, in pixels Bianshu = BB; Gets the number of edges, integers, starting from 3, to infinity, and n polygons are rounded jiaodu = 360/bianshu; Get each equal angle for (n=1 n<=bianshu; n++) //for loop, by Bianshu to control the number of loops, that is, the number of polygons to draw { a = daxiao* Math.Cos (n*jiaodu*math.pi/180); b = Daxiao*math.sin (n*jiaodu*math.pi/180); The coordinates of the starting point are calculated with trigonometric functions C = Daxiao*math.cos ((n+1) *jiaodu*math.pi/180); D = Daxiao*math.sin ((n+1) *jiaodu*math.pi/180); The coordinate createemptymovieclip ("Xian", N) of the endpoint are calculated. Create an empty movie xian,n as hierarchy with (Xian) { LineStyle (2, 0xff0000, MB); Define the size, color, transparency moveTo (a+300, b+200) of the line,///define the coordinates of the starting point of the drawing line, (300,200) is the center of the Polygon LineTo (c+300, d+200);//define the coordinates of the end of the drawing Line }} }