#!/usr/bin/perl -w use strict; use SWF qw(:ALL); #SWF::setScale(1.0); print "Content-type: application/x-shockwave-flash\n\n"; # movie properties #SWF::setScale(20.00000000); SWF::useSWFVersion(6); my $movie = new SWF::Movie(); $movie->setDimension(600,400); $movie->setBackground( 0xcc, 0xcc, 0xcc ); $movie->setRate(31); $movie->add( new SWF::Action(<<"EndOfActionScript") ); this.createTextField('tfNewfield',1,10,10,150,30); tfNewfield.text = "Here's some text"; tfNewfield.textColor = 0x00cc00; tfNewfield.border = true; //tfNewfield.embedFonts = true; fmtEmphasis = new TextFormat(); fmtEmphasis.size = 16; fmtEmphasis.font = "Arial"; tfNewfield.setTextFormat(fmtEmphasis); MovieClip.prototype.drawCircle = function(r, x, y) { this.moveTo(x+r, y); a = Math.tan(22.5 * Math.PI/180); for (var angle = 45; angle<=360; angle += 45) { // endpoint: var endx = r*Math.cos(angle*Math.PI/180); var endy = r*Math.sin(angle*Math.PI/180); // control: // (angle-90 is used to give the correct sign) var cx =endx + r*a*Math.cos((angle-90)*Math.PI/180); var cy =endy + r*a*Math.sin((angle-90)*Math.PI/180); this.curveTo(cx+x, cy+y, endx+x, endy+y); } }; sketchpad = { onMouseDown: function () { draw=true; moveTo(_xmouse, _ymouse); xold = _xmouse; yold = _ymouse; }, onMouseUp: function () { draw=false; }, onMouseMove: function () { if (draw) { //r = (_xmouse/600 * 0xff); g = (_ymouse/400 * 0xff) ; b = 0xff; r = (_xmouse/600) * 0xff; g = ((_xmouse*_ymouse)); b = (_ymouse/400 * 0xff); colorval = r << 16 | g << 8 | b << 0; lineStyle(10, colorval, 100); rad = 10 + (Math.abs(_xmouse-xold) + Math.abs(_ymouse-yold))/2; if( Math.random() > 0 ) { //lineTo( _xmouse, _ymouse ); curveTo( _xmouse,_ymouse, rad+_xmouse, rad+_ymouse); } else { drawCircle( rad, _xmouse, _ymouse ); } xold = _xmouse; yold = _ymouse; } }, onKeyDown: function () { clear(); } }; Mouse.addListener(sketchpad); Key.addListener(sketchpad); EndOfActionScript $movie->output();