//graphTing 0.2
var isLijn:Boolean=true;
var metFill:Boolean=false;
var graphStore:Array=new Array();//internal memory
//rollOver action on each pixel in the drawing field to start fading animation
die=function(clipje){
clipje.gotoAndPlay(2);
}
//a pixel gets 'noticed' when it receives another rollOver during its fading frames
notice=function(xCor,yCor,off_time){
var xpoint:Number=xCor;
var ypoint:Number=yCor;
var offTime:Number=off_time;
if(isLijn){
grafiek.lineTo(x_ctrl,y_ctrl);
graphStore.push("lt_"+x_ctrl+":"+y_ctrl);
}else{
var xHere:Number=x_ctrl-offTime;
var yHere:Number=y_ctrl-offTime;
grafiek.curveTo(xHere,ypoint,xpoint,yHere);
graphStore.push("ct_"+xHere+":"+ypoint+":"+xpoint+":"+yHere);
}
x_ctrl=xpoint;
y_ctrl=ypoint;
}
//function to start a new graph
clearGraf=function(){
graphStore=graphStore.splice(0);//reset memory
grafiek=this.createEmptyMovieClip("graf_"+3001,3001);
grafiek._x=400;
grafiek.lineStyle(1, 0x000000,40);
if(metFill){
grafiek.beginFill(0x888888,40);
graphStore.push("bf_def");
}
x_ctrl=200;
y_ctrl=200;
grafiek.moveTo(x_ctrl,y_ctrl);
graphStore.push("mt_"+x_ctrl+":"+y_ctrl);
}
//function to close present fill and start a new one, gets called when user clicks a pixel
closeFill=function(){
grafiek.endFill();
grafiek.moveTo(x_ctrl +1,y_ctrl+1);
if(metFill){
grafiek.beginFill(0x888888,40);
graphStore.push("bf_def");
}
}
// saving function
saveGraph=function(){
var aantal:Number=graphStore.length;
saveUrl="save_graphting.jsp?&aantal="+aantal;
var verzenden:LoadVars=new LoadVars();
for(i=0;i<aantal;i++){
verzenden["c"+i]=graphStore[i];
}
verzenden.send(saveUrl,"_blank","POST");
}
//inits the black drawing field, filling it with black 8x8 squares
var aantal:Number=2000;
for(i=0;i<aantal;i++){
duplicateMovieClip(vrg,"pix"+i,i);
this["pix"+i]._x=8*(i%50);
var rijlimiet=Math.floor(i/50);
this["pix"+i]._y=rijlimiet*8+35;
}
clearGraf();
download FLA file (version 8) - (mx 2004 version)