View Single Post
  #1 (permalink)  
Old Jan 5th, 2007, 05:55
doomlord doomlord is offline
New Member
Join Date: Jan 2007
Location: Australia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
draw a shape in flash tut

In this tut it will (probably) show you how to:
have actionscript randomly place the "point" circles (just so you can tell where your new shape is) but this version it keeps all the old shapes so you keep hitting the button and it just fills the screen up.
also i know nearly everyone that reads these forums can do this but im bored
1. Make a new document, give it a siaxe of 550_x by 400_y, and draw 4 circles whatever shape/size etc. and make them all seperate movieclip symbols (F8).
2. get the properties menu up, for me its on the bottom.
3. Give the first one an instance name of point1
4. give the second one an instance name of point2 and do this for the others
5. make a button, (F8) then button, then bring up the actionscript panel and paste this code (ill try to explain it my best)
Code:


Code: Select all
 
on (press) {
_root.point1._x = random(550); _root.point1._y = random(400); _root.point2._x = random(550); _root.point2._y = random(400); _root.point3._x = random(550); _root.point3._y = random(400); _root.point4._x = random(550); _root.point4._y = random(400); _root.lineStyle(1, 0x000000); _root.moveTo(point1._x, point1._y); _root.lineTo(point2._x, point2._y); _root.moveTo(point2._x, point2._y); _root.lineTo(point3._x, point3._y); _root.moveTo(point3._x, point3._y); _root.lineTo(point4._x, point4._y); _root.moveTo(point4._x, point4._y); _root.lineTo(point1._x, point1._y); }

Code: Select all
on (press) {
pretty simple, it means when this is pressed it does the following
Code: Select all
_root.point1._x=random(550);
this just gives point1 a random _x co-ordinate which is the horizontal line like this ______________
Code: Select all
_root.point1._y=random(400);
does the same as last but gives it a random vertical co-ordinate on the stage
and the rest of them does it for the rest
Code: Select all
_root.lineStyle(1, 0x000000);
we know what lineStyle means yes? (1, is how thick the lines for it are and 0x000000 is its colour which in this case is black
Code: Select all
_root.moveTo(point1._x, point1._y);
is where the line starts and in this case its point 1
Code: Select all
_root.lineTo(point2._x, point2._y);
Ends the line at point 2 and all the rest do the same to make a shape
Code: Select all
}
ends it
6. put this on the frame of it

Code: Select all
stop();

6. if you did what i said you probably got what i got, also hit ctrl+enter to test it and hit the generate button you made to keep making new shapes over the old ones
hope you understood me http://www.mytempdir.com/1149845
when you get it and have it opened in flash just hit ctrl+enter then you can test it

Last edited by Daniel; Jan 8th, 2007 at 10:11. Reason: coding