Difference between revisions of "Swf.pl"

From Organic Design wiki
(Read in peer.as to compile from)
m
Line 10: Line 10:
 
# Read peer.as source script
 
# Read peer.as source script
 
my $as = readFile( my $file = 'peer.as' );
 
my $as = readFile( my $file = 'peer.as' );
@stat = stat( $file );
+
my @stat = stat( $file );
 
my $output = logAdd "Compiling from \"$file\" ($stat[7] bytes)\n\n";
 
my $output = logAdd "Compiling from \"$file\" ($stat[7] bytes)\n\n";
  

Revision as of 00:53, 15 February 2006

use SWF::Builder;

  1. We may use a dedicated child for serving SWF requests

sub swfd { }

  1. Compile a SWF interface for this peer

sub swfCompile {

# Read peer.as source script my $as = readFile( my $file = 'peer.as' ); my @stat = stat( $file ); my $output = logAdd "Compiling from \"$file\" ($stat[7] bytes)\n\n";

my $swf= SWF::Builder->new( FrameRate => 50, FrameSize => [0, 0, 640, 480], BackgroundColor => 'cccccc' );

# Red triangle my $shape = $swf->new_shape ->fillstyle('ffffff') ->linestyle(1, '000000') ->moveto(0,-11) ->lineto(10,6) ->lineto(-10,6) ->lineto(0,-11); my $instance = $shape->place;

for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) }

$swf->save( $file = "$::peer.swf" ); @stat = stat( $file ); $output .= logAdd "SWF Instance compiled: $file ($stat[7] bytes)\n"; return $output; }