Help with targeting in drawing app
Hello all. I need some help. I installed a flash drawing board on a site, and it all finally works pretty good. The source files are from f-mod.com, called “swfdraw2jpg”. It works great, and I modified the original file to make it look as I want it to on my site. Here’s the problem: I don’t want to continue to use the cline changer and color picker included with those files, i want to make simple color swatches, just a few select colors to choose from. All the most of the actionscript lives on a seperate .as file. I can’t seem to target the line to change the color. I have included the as below. The color picker also has a separate as. file. I just can’t fig out how to target the pencil_mc to manipulate it. Thanks for your help!
// this .as provide all the basic drawing functions, and the data encoding motor to php;
//define your own path, where you uploaded the files;
serverpath = “www.mysite.com”;
//if this key is pressed while pushing the “save button” , you will get php what the php file displays… make it blank to prevent this.
debugHotKey = “SPACE”;
//init arrays that define the draw : points, colors, and pencilwidth
mca.points = [];
mca.colors = [];
mca.pencilwidths = [];
pencilwidth =10;
pencilcolor = “foo”;
colorpalette.loadmovie(“web216.swf”);
// classic drawing tool using draw api
// ******************************
_root.createEmptyMovieClip(“pencil_mc”,1);
// when mouse down
// init on mousemoove draw func
/*
about compressed data transmition to php :
*when we get values of more than 2 caracter, reduce them by letter coding
the points array update every mousemoove, while the color and width not.
so : point and color info is stocked in array only at each change like :
- number of values in points array_my new color value;
*then php will parse the data, reversing with the compression key;
see file "alphaencode.as "
*/
_root.onMouseDown = function(){
if(_xmouse<=500 && _xmouse>=0 && _ymouse<=260 && _ymouse>=0){
pencil_mc.moveTo(_xmouse,_ymouse);
pencil_mc.lineStyle(pencilwidth,“0x”+pencilcolor,100);
this.onMouseMove = function(){
if(_xmouse<=500 && _xmouse>=0 && _ymouse<=260 && _ymouse>=0){
pencil_mc.lineTo(_xmouse,_ymouse);
mca.points.push(codes[int(xmouse)]+""+codes[int(ymouse)]);
trace(mca.points.length);
if (pencilcolor <>lastpencilcolor){
pointref = mca.points.length-1;
mca.colors.push(pointref+""+codes[level0.r]+""+codes[level0.g]+""+codes[_level0.b])
lastpencilcolor = pencilcolor ;
trace (“color changed”);
}
if (pencilwidth<>lastpencilwidth){
pointref = mca.points.length-1;
mca.pencilwidths.push(pointref+"_"+pencilwidth);
lastpencilwidth = pencilwidth;
trace (“brush changed”);
}
}
}
}
}
// ******************************
// ******************************
// setting drawing func to null onmouseup
// ******************************
_root.onMouseUp = function(){
this.onMouseMove = null;
//pencil_mc.endfill();
mca.points.push("_");
}
// ******************************
// ******************************
// erase button
// ******************************
boutonEffacer.onPress = function(){
_root.pencil_mc.clear();
}
redChange.onPress = function(){
_root.pencil_mc.clear();
}
instanceName.// ******************************
//changing line width
// ******************************
changelinestyle = function(coef){
maxlinewidth = 50;
minlinewidth = 1;
if( pencilwidth == maxlinewidth && coef > 0 )return;
if( pencilwidth == minlinewidth && coef < 0 )return;
linechanger.circle._height+=coef;
linechanger.circle._width+=coef;
pencilwidth = linechanger.circle._width;
}