#!/usr/bin/perl
use Flash;
use CGI;
my $q = new CGI;
print $q->header(-type=>'application/x-shockwave-flash');
my $width = 403;
my $height = 250;
openswf("-",$width,$height,1);
for (my $a=0; $a<10; $a++)
{
my $pair = {};
$pair->{x} = (rand $width) - $width/2;
$pair->{y} = (rand $height) - $height/2;
$coords[$a] = $pair;
}
# --- set field of view
ortho2(-$width/2,$width/2,-$height/2,$height/2);
# --- just to init colors
mul_colour(1,1,1,1);
add_colour(0,0,0,0);
# --- define an image
my $bitmapid = nextid();
define_bitmap($bitmapid,"map.jpg");
my $nid = rect_image($bitmapid);
push_matrix;
translate(0,0,-100);
#scale(0.5,0.5,0.5);
place_object($nid,00);
pop_matrix;
show_frame;
add_colour(1,0,0,0);
for (my $a=0; $a<scalar(@coords)-1; $a++)
{
my $id = nextid();
line ($id, $coords[$a]->{x}, $coords[$a]->{y}, $coords[$a+1]->{x}, $coords[$a+1]->{y},2);
push_matrix;
translate(0,0,0);
add_colour(1,0,0,-0.6);
place_object($id,10);
pop_matrix;
show_frame;
}
closeswf;
exit 0;
syntax highlighted by Code2HTML, v. 0.8.12