#!/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(10); $movie->add( new SWF::Action(<<"EndOfActionScript") ); MovieClip.prototype.rectangle = function(w, h, x, y, stroke, fill) { this.lineStyle(stroke.width, stroke.color, stroke.alpha); this.beginFill(fill.color, fill.alpha); this.moveTo(0, 0); this.lineTo(w, 0); this.lineTo(w, h); this.lineTo(0, h); this.endFill(); this._x = x; this._y = y; }; level=0; MovieClip.prototype.makeNewRect = function(name,x,y) { cstroke = {width:1, color:0x0000aa, alpha:50}; ccolor = {color:0xcc0000, alpha:50}; createEmptyMovieClip( name, level++ ); _root[name].rectangle(60, 40, x, y, cstroke, ccolor); }; this.createTextField('tfStatus',level++,10,10,150,30); tfStatus.textColor = 0x33cc33; tfStatus.autoSize = "true"; tfStatus.text = "status"; makeNewRect("arect",100,100); rect_count=0; funclist = { onMouseUp: function () { draw=false; }, onMouseDown: function () { draw=true; tfStatus.text = "mouseDOWN: ("+_xmouse+","+_ymouse+")"; }, onMouseMove: function () { arect._x = _xmouse; arect._y = _ymouse; tfStatus.text = "mousemove: ("+_xmouse+","+_ymouse+")"; if( draw ) { arect._rotation += 10.1111; rect_name = "rect"+rect_count; makeNewRect( rect_name, _xmouse,_ymouse ); _root[rect_name]._rotation = arect._rotation; rect_count++; } }, onKeyDown: function () { clear(); } }; Mouse.addListener(funclist); Key.addListener(funclist); EndOfActionScript $movie->output();