Hi there's a little tutorial asked by Kutay on how to draw a lttle box.
Level :easy Time : 5 minutes
STEP 1: Draw an horizontal line using the RECTANGLE tool. Select the color you want. Use the transform panel to enter those values X: What you want (leave the value you have) Y: What you want (leave the value you have) W: What you want but suggest you 100 H: What you want but suggest you 2 Anchor point : Top Left Mode : Resize use the shape panel to name this shape line1 and check target box
Now you have to copy paste this line1 three times. Select the line1 in the left panel of SwishMax and press Ctrl-c and Ctrl-V (three times)
Select the first of the new lines and in shape panel change the name to line2 make the same operation to the two others new lines and give them the name line3 and line4 NOW IMPORTANT: Select line2 and in transform panel change the anchor point to Top right Select line3 and in transform panel change the anchor point to Bottom right Select line4 and in transform panel change the anchor point to Bottom left
Right you have made step 1
STEP 2:
Copy/paste this code in script panel of Scene_1 (go to expert mode) Code seems larger, but no. There's a lot of comments you can delete if you want.
QUOTE
onLoad () {
box_width=225; // This is the widht your box will have. Put the number you want box_height=226; // This is the height your box will have. Put the number you want line1._x=50; // Coordinate of the first point of line1 line1._y=45; // Coordinate of the first point of line1 // This coordinate will be coordinate of the top-left corner of your box // Change with your numbers line_thin = 8; // Thin of the box line
// Do not change anything under this line
// The next group of lines initialize coordinates of line2, line3, line4 // based on coordinates of line1 and using width and height of box as // defined in previous section line2._x=line1._x + box_width; line2._y=line1._y; line3._x=line2._x; line3._y=line2._y + box_height; line4._x=line3._x - box_width; line4._y=line3._y;
// The next group put widht or height (depending if they are horizontal or vertical lines) to 0 // This way lines will be invisible before drawing line1._width=0; line2._height=0; line3._width=0; line4._height=0;
// The next group put widht or height (epending if they are horizontal or vertical lines) to 0 // The lines will have the thin we define in first section line1._height=line_thin; line2._width=line_thin; line3._height=line_thin; line4._width=line_thin;
} onEnterFrame() { // Here we draw th four lines // First drawing line1 line1._width= math.approach(line1._width,box_width,.8); // if line1 drawd go to draw line2 if (line1._width>box_width-1) { line2._height= math.approach(line2._height,box_height,.8); } // if line2 drawd go to draw line3 if (line2._height>box_height-1) { line3._width= math.approach(line3._width,box_width,.8); } // and if line3 drawd go to draw line4 if (line3._width>box_width-1) { line4._height= math.approach(line4._height,box_height,.8); } // It should be better to delete the onenterFrame now. }
Right! Hope it helps you Kutay and others... Feel free to ask, but better here than by PM, you will receive more answers... take a look .: HERE :. at the results and download the sample... Cheers.