View Full Version : Whiteboard
Pattt
January 15th, 2005, 03:19 PM
Hey, i'm working with a draw-program in flash.
I've done so you can draw and clear.
But i wanna do a function so you can draw circels, squares and more..
How? :p
e.s.x.s
January 15th, 2005, 05:01 PM
u should use curveTo() property for drawing a circle and u need to specify the coordinates between the curves of it. u can do this with the mouse actions :.. get the x property value from the "press" and "release" actions.. and than set your circle's width and height by the difference of the two x values that u get before.
u can use the same way for drawing a square..
but if u want to draw a triangle,u should use trigonometry methods of the Math class.
these are the hardway solutions of your question: u can do all of these with duplicating a MovieClip that u draw before ( square, circle or triangle )...
good luck ;)
Pattt
January 15th, 2005, 06:41 PM
Thanks...
I tested it, but I just got a strange figure, not a oval..
curveTo(100, 100, 10, 10);
I don't know how i'm gonna do.. please help!
scotty
January 16th, 2005, 03:27 AM
Have you seen this
http://www.kirupa.com/developer/actionscript/tricks/drawing_api.htm
scotty(-:
Jerryscript
January 16th, 2005, 03:44 AM
There are some drawing classes you can use as well at http://flashmx2004.com/forums/index.php?showtopic=323&hl=drawing+class
Pattt
January 16th, 2005, 11:04 AM
Great links!
Now i understand how to "do" circles and squares.
But i don't know how i'm gonna do so i can "draw" it in my whiteboard.
Do someone know?
Pattt
January 16th, 2005, 11:55 AM
Or wait, I found a code!
Just one problem, when you stop pressing the mouse, the square disapears!
Need help to fix it.
_root.createEmptyMovieClip("box", 1);
var thickness = 1;
var lcolour = "0x000000";
var scolour = "0x999999";
var boxalpha = 60;
var mDown = false;
var startx, starty, endx, endy;
_root.onMouseDown = function() {
mDown = true;
startx = _xmouse;
starty = _ymouse;
};
_root.onMouseUp = function() {
mDown = true; //-----------HERE!!!
};
_root.onEnterFrame = function() {
endx = _xmouse;
endy = _ymouse;
box.clear();
box.lineStyle(thickness, lcolour, boxalpha);
if (mDown) {
box.beginFill(scolour, boxalpha);
box.moveTo(startx, starty);
box.lineTo(endx, starty);
box.lineTo(endx, endy);
box.lineTo(startx, endy);
box.lineTo(startx, starty);
box.endFill();
}
};
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.