I have made a little drawing program for my daughter, and I have worked in the ability to save and load images that you have made. It’s a simple line drawing thing, but she’s 3, and it works.
What I need help with (and I’m still new with Flash and AS3) is that I can “addChild” to put the jpeg on the stage, but it’s on (or over top of) the drawing area. That means that when I start to draw, I don’t really add to the picture, instead, it’s drawing behind it.
I used the line drawing tutorial as the basis for this little app, the basic code is :
public function DrawMain(){
graphics.lineStyle(theLine,0x000000); //default to black lines
toDraw = false;//to start with
stage.addEventListener(MouseEvent.MOUSE_DOWN, StartDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, Drawing);
stage.addEventListener(MouseEvent.MOUSE_UP, StopDrawing);
stage.addEventListener(KeyboardEvent.KEY_DOWN, PenStatus);
alpha = theAlpha;
}
public function StartDrawing(e:MouseEvent):void{
//move to the correct positon for drawing
graphics.moveTo(mouseX, mouseY);
toDraw = true;
}
public function Drawing(e:MouseEvent):void{
if(toDraw){
graphics.lineTo(mouseX,mouseY);
}
}
public function StopDrawing(e:MouseEvent):void{
toDraw = false;
}
Anyone know what I can do to have this data “in” the stage, not “on” it?