How to make a simple paint application in Adobe Flash - 1
How to make a simple paint application in Adobe Flash - Part 2
How to make a simple paint application in Adobe Flash
In this tutorial I will be showing you how to make a simple paint app in Adobe Flash. For making this simple paint application in flash you need to make 2 files for that.First file will be the flash file titled as 'name_of_file.fla' and the second file will be 'file_name.as'. Here fla stands for flash and as stands for actionscript. I have made 2 files available to you as ' paint app.fla ' and ' Ellipse.as '.You can download the file with the links given below.But it will be awesome if you write the code yourself and understand it first by watching these two videos.
Code for paint_app.fla file
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.MOUSE_DOWN, beginDraw);
function beginDraw(e:MouseEvent)
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, startDraw);
}
stage.addEventListener(MouseEvent.MOUSE_UP, endDraw);
function endDraw(e:MouseEvent)
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, startDraw);
}
function startDraw(e:MouseEvent)
{
var drawing:Ellipse = new Ellipse;
addChild(drawing);
drawing.x = mouseX;
drawing.y = mouseY;
}
Code for Ellipse.as file
package {
import flash.display.MovieClip;
public class Ellipse extends MovieClip{
public function Ellipse(w:Number = 10, h:Number= 10, color:Number = 0x00FF00) {
graphics.beginFill(color);
graphics.drawEllipse(0,0,w,h);
graphics.endFill();
}
}
}
Sir, Kindly Email us the code for reset or erase?
ReplyDelete