Difference between revisions of "Swf.pl"
(restructure) |
(Read in peer.as to compile from) |
||
| Line 7: | Line 7: | ||
# Compile a SWF interface for this peer | # Compile a SWF interface for this peer | ||
sub swfCompile { | sub swfCompile { | ||
| − | my $ | + | |
| + | # Read peer.as source script | ||
| + | my $as = readFile( my $file = 'peer.as' ); | ||
| + | @stat = stat( $file ); | ||
| + | my $output = logAdd "Compiling from \"$file\" ($stat[7] bytes)\n\n"; | ||
my $swf= SWF::Builder->new( | my $swf= SWF::Builder->new( | ||
| Line 27: | Line 31: | ||
for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) } | for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) } | ||
| − | $swf->save( | + | $swf->save( $file = "$::peer.swf" ); |
| − | + | @stat = stat( $file ); | |
$output .= logAdd "SWF Instance compiled: $file ($stat[7] bytes)\n"; | $output .= logAdd "SWF Instance compiled: $file ($stat[7] bytes)\n"; | ||
return $output; | return $output; | ||
} | } | ||
Revision as of 00:31, 15 February 2006
use SWF::Builder;
- We may use a dedicated child for serving SWF requests
sub swfd { }
- Compile a SWF interface for this peer
sub swfCompile {
# Read peer.as source script my $as = readFile( my $file = 'peer.as' ); @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; }



