senocular, i’m trying to get rid of the only bug i have in my drawing API ecard. Your little application got me on the right track last night. so thanks a lot for that. I’m recording all the points and lineStyle on MouseDown. and putting them in an Array and etc. but when i’m getting the data back and recreating the points - they’re all connected - so if you put a dot on the left side and a dot on the right - there would be a line when going through the results… so i need to split an array one more time…and something tells me that i’m not doing it the most efficient way…
tell me if you have any thoughts on this…when you get a chance
//... this.onMouseDown
this.onMouseMove = function() {
if(board.hitTest(_root._xmouse,_root._ymouse,true)){
mousePos.push(style.thickness);
mousePos.push(style.col);
mousePos.push(style.opacity);
mousePos.push(board._xmouse);
mousePos.push(board._ymouse+"#");
board.line.lineTo(board._xmouse, board._ymouse);
}
// then add ":" onMouseUp - so they're not all connected...
this.onMouseUp = function() {
//mousePos.push(":");
......
this is what the array looks up to now - 9,16711680,40,43.95,71#,9,16711680,40,44.95,71#,9,16711680,40,45.95,71#,9,16711680,40,46.95,71#,9,16711680,40,47.95,71#,9,16711680,40,48.95,71#,9,16711680,40,49.95,71#,9,16711680,40,51.95,71#,9,16711680,40,52.95,71#,[SIZE=7]:[/SIZE],9,16711680,40,43.95,98#,9,16711680,40,44.95,98#,9,16711680,40,45.95,98#,9,16711680,40,46.95,98#,9,16711680,40,46.95,100#,9,16711680,40,47.95,100#,9,16711680,40,48.95,100#,9,16711680,40,49.95,100#,9,16711680,40,51.95,100#,9,16711680,40,51.95,101#,9,16711680,40,52.95,101#,9,16711680,40,53.95,101#,9,16711680,40,54.95,101#,9,16711680,40,54.95,102#,[SIZE=7]:[/SIZE]
Then i mousePos.toString() and send the string to a db
GETTING THE RESULTS BACK
//newDrawing - var that's getting passed from the db - has all my points
myString=newDrawing;
//and here i'm trying to split it 2 times.
//i need to split it 3 times or maybe there's a better way
// first would be with ":" then with "#," and then with "," to get to my individual values
firstArray=myString.split("#,");
// /*
for (i=0; i<firstArray.length; i++) {
finalArray.push(firstArray*.split(","));
}
j=1;
while( j<finalArray.length) {
j++;
mc.moveTo(finalArray[j-1][3], finalArray[j-1][4]);
//[3] and [4] are x and y
mc.lineStyle(finalArray[j][0],finalArray[j][1],finalArray[j][2]);
//[0][1][2]-stroke,color and opacity
mc.lineTo(finalArray[j][3], finalArray[j][4]);
}
}
i know this is huge so like i said when you get a chance i can use some help…
thanks man i appreciate you