this is the prob. i want to do something like a blackboard wherein i get to write something on the blackboard using the chalk. (i.e. a circle will do for now)
just one more thing, what if I want flash to just draw a perfect circle say for example a slide show how do I do that?
the scene is just supposed to draw a circle because the lesson is about teaching shapes and the next scene i’ll discuss a square so i want flash to make a square in the window using the chalk I have on the bottom of the screen. it’s like the chalk from the bottom is the one that’s going to draw the circle and the square.
Thanks Ian?
Anywa, it shouldn’t be too difficult, but not too easy either. Especially for the circle. By the way, do you want your shapes to appear on the screen or to be drawn on the screen?
I’m trying, I’m trying… But it’s more difficult than I thought. The thing is I can draw little by little a line between 2 points, but then when it’s done I can’t get it to draw the newt line
i’ve been trying to find a script everywhere… i’ve been in front of the computer the whole afternoon but still no sign of a light bulb lighting up anytime soon… i’m glad you’re trying to help me out… really…
as soon as you come up with anything i’d be really grateful if you’d post…
Phwew! That wasn’t easy at all. Strangely enough, I eventually made it by mistake :P. An error in a sign, I forget something else and it works perfectly. Go figure…
The good thing is: it’s just code.
The bad thing is: it’s nothing but code. I’ll try and explain it:
*// My little drawing prototype :)
// destx: final _x destination
// fromx: start _x position
// stage: number of stages from the origin to the destination*
MovieClip.prototype.lineStage = function (destx,desty,fromx,fromy,stage)
{
if (i<=stage)
{
*// if I'm not arrived to the new point, draw a bit of the line*
xpos=i*(fromx-destx)/stage;
ypos=i*(fromy-desty)/stage;
this.lineTo(-fromx+xpos,-fromy+ypos);
i++;
} else
{
*// otherwise let's go to the next point, referenced in the
// array aPos. We reset i (stage counter) and increment j
// (point counter)*
i=0;
if (j++==aPos.length) _root.onEnterFrame=null;
}
}
*// Now the easy stuff! The array declaration, then we create
// the clip in which we'll draw, we position it, set a style, put
// the point counter on the first point, put the drawing point
// where it should be (told you it's the easy part :)*
aPos=new Array(new Array(0,0),new Array(0,50),new Array(50,50),new Array(50,0));
_root.createEmptyMovieClip("drawing",1);
drawing._x=drawing._y=75;
drawing.lineStyle(4,0xffffff,100);
j=0;
drawing.moveTo(aPos[j][0],aPos[j][1]);
*// We define the enterFrame, which simply calls the prototype
// on the drawing clip.*
_root.onEnterFrame=function()
{
drawing.lineStage(aPos[j+1][0],aPos[j+1][1],aPos[j][0],aPos[j][1],10);
}
And voila! If you want it to draw a circle, you’ll have to populate your aPos array with the right coordinates.
Good luck!
By the way, my advice would be: don’t bother trying to understand that code. First if you don’t have a good level in Actionscript you won’t understand it, and secondly I have a very twisted mind so my scripting is as illogical as it gets.
By the way, I’m in the middle of creating something nice based on that drawing idea. I’ll show you when I’m done.