50 && mouseX < w-50 && mouseX > 50) { //color = Math.random() * 0xFFFFFF; //txt.text = "Color: 0x" + color.toString(); //if (togsplat == 1) { toggle_painting(); //} } } private function start_painting():void{ dopaint = 1; addEventListener(Event.ENTER_FRAME, paint); } private function stop_painting():void{ dopaint = 0; removeEventListener(Event.ENTER_FRAME, paint); } private function toggle_painting():void{ if (dopaint == 0) start_painting(); else stop_painting(); } public function paint(event:Event):void { //counter++; //txt.text = counter.toString(); //if (with_wii == 0) { //vpX = mouseX; //vpY = mouseY; //} splat = Math.random() * 0xFFFFFF; //AE //graphics.lineTo(mouseX, mouseY); /** * * The code for the paint function was ported and adapted from: * "Splatter", by Stamen Design * http://stamen.com/projects/splatter * **/ mid_x = ((end_x - start_x) * (1 + mid_point_push)) + start_x; mid_y = ((end_y - start_y) * (1 + mid_point_push)) + start_y; start_x = end_x; start_y = end_y; //end_x = vpX;// = mouseX; //end_y = vpY;// = mouseY; end_x = mouseX; end_y = mouseY; distance = Math.sqrt(Math.pow((end_x - start_x), 2) + Math.pow((end_y - start_y), 2)); new_size = max_line_width / distance; size = aggression*new_size;//(new_size_influence * new_size) + ((1 - new_size_influence) * size); splatter(painting.graphics, start_x, start_y, end_x, end_y, mid_x, mid_y, size); parity = false; /* _parent.new_size_influence += ((Math.random() * 0.1) - 0.05); _parent.mid_point_push += ((Math.random() * 0.1) - 0.05); _parent.max_line_width += ((Math.random() * 4) - 2); */ new_size_influence += ((Math.random() * 0.1) - 0.05); mid_point_push += ((Math.random() * 0.1) - 0.05); max_line_width += ((Math.random() * 4) - 2); } private function splatter(obj:Graphics, x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number, d:Number):void { //var obj:Graphics = painting.graphics; obj.lineStyle(d, splat, 100); //txt.text = d.toString(); obj.moveTo(x1, y1); obj.curveTo(x3, y3, x2, y2); //curves.push([x1, y1, x3, y3, x2, y2, d]); // splotch var dd:Number = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2)); for (var i:uint = 0; i