1#!/usr/local/bin/perl -wT
2use strict;
3
4use SWF qw(:ALL);
5SWF::setScale(20.0);
6
7my $dir = '../common/';
8
9
10print "Content-type: application/x-shockwave-flash\n\n";
11
12my $s = new SWF::Shape();
13my $alpha = new SWF::Bitmap($dir."flowers.jpg", $dir."flowers.msk");
14
15
16
17my $f = $s->addFill($alpha);
18$s->setRightFill($f);
19$s->drawLine(640, 0);
20$s->drawLine(0, 480);
21$s->drawLine(-640, 0);
22$s->drawLine(0, -480);
23
24my $c = new SWF::Shape();
25$c->setRightFill($c->addFill(0x99, 0x99, 0x99));
26
27$c->drawLine(40, 0);
28$c->drawLine(0, 40);
29$c->drawLine(-40, 0);
30$c->drawLine(0, -40);
31
32my $m = new SWF::Movie();
33$m->setDimension(640, 480);
34$m->setBackground(0xcc, 0xcc, 0xcc);
35
36# draw checkerboard background
37my ($x, $y);
38my $i;
39for($y=0; $y<480; $y+=40){
40    for($x=0; $x<640; $x+=80){
41	$i = $m->add($c);
42	$i->moveTo($x, $y);
43    }
44    $y+=40;
45
46    for($x=40; $x<640; $x+=80){
47	$i = $m->add($c);
48	$i->moveTo($x, $y);
49    }
50}
51
52$m->add($s);
53# decide if its called from commandline or as cgiscript
54if (exists $ENV{"REQUEST_URI"}){
55	print "Content-type: application/x-shockwave-flash\n\n";
56	$m->output();
57}
58else {
59	$m->save("$0.swf");
60	print "Generated file written to $0.swf\n";
61}
62