#!/usr/bin/perl -w use strict; use SWF qw(:ALL); #SWF::setScale(1.0); print "Content-type: application/x-shockwave-flash\n\n"; SWF::useSWFVersion(6); my $movie = new SWF::Movie(); $movie->setDimension(600,400); $movie->setBackground( 0xcc, 0xcc, 0xcc ); $movie->setRate(15); $movie->add( new SWF::Action(<<"EndOfActionScript") ); MovieClip.prototype.loadjpg = function(picName, holderName) { // holderName can be passed in case needed for progress indicator // if not passed, use 'holder' as default var h = holderName==undefined ? "holder" : holderName; this.createEmptyMovieClip(h, 1); this._visible = false; this[h].loadMovie(picName); var id = setInterval( function (mc) { if (mc[h].getBytesLoaded() > 1 && mc[h].getBytesLoaded() > mc[h].getBytesTotal()-10 && mc[h]._width > 0) { mc._alpha = 99; clearInterval(id); mc._visible = true; mc.onComplete(); } else { mc.onLoading(); } }, 80, this); }; function maskIt() { this.createEmptyMovieClip( "tri", 2 ); with (this.tri) { beginFill(0,100); moveTo(100,2); lineTo(150,150); lineTo(30,35); lineTo(100,2); endFill(); }; this.setMask( this.tri ); } function positionIt() { this._x = 200; this._y = 100; } // rotate around center function rotateIt() { // position correctly once this.holder._x = 0 - this.holder._width/2; this.holder._y = 0 - this.holder._height/2; // this.squ._x = 0 - this.squ._width/2; // this.squ._y = 0 - this.squ._height/2; // rotate on each frame this.onEnterFrame = function() { this._rotation += 5; this.squ._rotation += 5; }; } this.createEmptyMovieClip( "myjpg", 1); //myjpg.onComplete = positionIt; //myjpg.onComplete = maskIt; myjpg.onComplete = rotateIt; myjpg.loadjpg("jed-legless.jpg"); myjpg.createEmptyMovieClip( "squ", 2 ); with ( myjpg.squ ) { beginFill(0,50); moveTo(-180,-170); lineTo( 180,-170); lineTo( 180, 170); lineTo(-180, 170); lineTo(-180, 170); endFill(); }; myjpg.setMask( myjpg.squ ); myjpg._x = 300; myjpg._y = 200; funclist = { onMouseUp: function () { draw=false; }, onMouseDown: function () { mosh(_xmouse,_ymouse); draw=true; }, onMouseMove: function () { if( draw ) { myjpg._x = _xmouse; myjpg._y = _ymouse; } } }; Mouse.addListener(funclist); EndOfActionScript $movie->output();