// Convert MX Drawing API Output to JPEG Using PHP and GD
// Jerry Jasuta

// variables
drawing=false; // keeps track of mousedown status
data=''; // variable to hold drawing data
// note - place a textfield on stage with variable name "data"

// set a key listener for clearing the drawing
createEmptyMovieClip('_keyListener',1);
Key.addListener(_keyListener);
_keyListener.onKeyDown=function(){
clear();
_root.data='';
};

// root event handlers
with(_root){

onMouseDown=function(){
drawing=true;
startX=_xmouse;
startY=_ymouse;
moveTo(startX,startY);
};

onMouseUp=function(){
drawing=false;
};

onMouseMove=function(){
if(drawing==true){
lineStyle(1);
lineTo(_xmouse,_ymouse);
// if drawing is in the canvas, add current drawing data to the lines variable
if(drawing==true && _ymouse<200){
lineStyle(1);
lineTo(_xmouse,_ymouse);
_root.data+=startX+'_'+startY+'_'+_xmouse+'_'+_ymouse+'-';
startX=_xmouse;
startY=_ymouse;
}
updateAfterEvent();
};

}

// the button uses on(release){getURL('create-jpeg.php','_blank','POST');}
// to send the lines data to the php conversion script


Free Hosting Provide By: Web Hosting Service http://www.hostrocket.com
Make $50 Per Sale: VoIP Affiliate Program http://affiliates.viatalk.com
ViaTalk: Internet Phone Service http://www.viatalk.com