More Research and Testing

Today I have done some research on another piece of software that we are going to use in our project. Previously I had said that we were certain that we were going to use the programming software called Processing, but after much consideration and group meetings we have decided that we are going to use Flash. Why are we going to use Flash? Well, we have been studying it for the last 3-4 years and in my case I think I feel much more comfortable using it. We also had a massive project to make in Interactive Programming using Adobe Flash and after completing it I have learned a lot of important parts to the Flash system and also to the actionscript code. So today I wanted to do some testing with Flash using Actionscript code. As we have explained our project is going to based around drawing. We want the user to have a selection of colours that the can use so I did some coding and I came up with the colour pallete below. I think it is much more up to date than anything we could do in processing and I also think it looks more professional. I also inserted a “Erase” button on the stage just to give the user that option if the wanted to undo what the have drawing but we as a group have to decided whether we are going to keep that in the program or not. I also created a tool which lets the user select the line thinkness that they want. I thought that this would be a handy tool because if the were drawing something like a tree trunk it would save them colouring the whole tree trunk, instead they would just get the thickest line, which is 7, and select the colour brown and just draw the tree trunk. These are all just little ideas that could be incorporated into our project but are not definitive. I also have to do some research to see if reacTIVision will work with Flash because that is something else we are thinking of incorporating into our game in relation to using the cubes to select you background.

Capture

var spBoard:Sprite=new Sprite();

this.addChild(spBoard);

spBoard.x=280;

spBoard.y=30;

var shDrawing:Shape=new Shape();

spBoard.addChild(shDrawing);

var doDraw:Boolean=false;

var lineSize:Number=7;

var currentColor:Number;

sizeBox.text=String(lineSize);

spBoard.graphics.lineStyle(1,0×000000);

spBoard.graphics.beginFill(0xFFFFFF);

spBoard.graphics.drawRect(0,0,250,250);

spBoard.graphics.endFill();

spBoard.filters = [ new DropShadowFilter() ];

spBoard.addEventListener(MouseEvent.ROLL_OUT,boardOut);

spBoard.addEventListener(MouseEvent.MOUSE_MOVE,boardMove);

spBoard.addEventListener(MouseEvent.MOUSE_DOWN,boardDown);

spBoard.addEventListener(MouseEvent.MOUSE_UP,boardUp);

function boardOut(e:MouseEvent):void {

doDraw=false;

}

function boardDown(e:MouseEvent):void {

doDraw=true;

currentColor=cpColor.selectedColor;

shDrawing.graphics.lineStyle(lineSize,currentColor);

shDrawing.graphics.moveTo(shDrawing.mouseX,shDrawing.mouseY);

}

function boardUp(e:MouseEvent):void {

doDraw=false;

}

function boardMove(e:MouseEvent):void {

var curX:Number=shDrawing.mouseX;

var curY:Number=shDrawing.mouseY;

if(doDraw && checkCoords(curX,curY)){

shDrawing.graphics.lineTo(curX,curY);

e.updateAfterEvent();

}

}

function checkCoords(a:Number,b:Number):Boolean {

if(a>=250-lineSize/2 || a<=lineSize/2 || b>=250-lineSize/2 || b<=lineSize/2){

return false;
}

else {

return true;
}

}

btnErase.addEventListener(MouseEvent.CLICK, eraseClicked);
function eraseClicked(e:MouseEvent):void {

shDrawing.graphics.clear();

}

btnUp.addEventListener(MouseEvent.CLICK, upClicked);

function upClicked(e:MouseEvent):void {

if(lineSize<20){

lineSize+=1;

} else {

lineSize=20;

}

sizeBox.text=String(lineSize);

}

btnDown.addEventListener(MouseEvent.CLICK, downClicked);

function downClicked(e:MouseEvent):void {

if(lineSize>1){

lineSize+=-1;

} else {

lineSize=1;

}

sizeBox.text=String(lineSize);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s