#!/usr/bin/perl use warnings; use strict; # steps to make your own audio slideshow # 1. create a directory named "pics" and # put all your jpgs in pic/*.jpg # 2. Create your audio swf , if desired # with wav2swf from swftools. # ./wav2swf -o mywav.swf mywav.wav # It creates a well compressed embedded mp3 # 3. Make your slideshow with this script # ./1slides-gen.pl > 1slides.swf # 4. Combine the audio with the slideshow ( if desired ) # ./swfcombine -o 1slides-w-audio.swf 1slides.swf Z=mywav.swf # Z is a flash name given to the MovieClip for audio ( see below). use SWF qw(:ALL); #from Ming distro # http://prdownloads.sourceforge.net/ming/ming-0.3beta1.tar.bz2?download # http://ming.sourceforge.net/ # Download and build the included Perl port my $m = new SWF::Movie(); $m->setRate(10.0); $m->setBackground( 0, 0, 0 ); ######################################################### # Add sound for importing an audio.swf file with swfcombine. # This movie sound clip will be played in parallel with the # main movie. # The sound is added later with swfcombine (from SWFTOOLS) # http://www.swftools.org/ # This is the only way I could find to add sound. You need to # make an swf audio file with wav2swf (from swftools), then use # swfcombine (from swftools) to add the audio as a parallel # movie clip to the main movie $m. my $s = new SWF::MovieClip(); my $is = $m->add($s); $is->setName("Z"); ########################################################## ########################################################### my $p = new SWF::Sprite(); my $toggle = -1; #//The directory where these images reside my @images = ; #//Execute function foreach my $img ( @images ) { $toggle *=-1; makeImgMovie( $img ); } $m->nextFrame(); $m->output(); ############################################################## sub makeImgMovie{ my $imgfile = shift; my $b = new SWF::Bitmap( $imgfile ); my $w = $b->getWidth(); my $h = $b->getHeight(); $m->setDimension($w, $h); my $i = $p->add($b); for(my $j=0; $j<20; ++$j) { $p->nextFrame(); } for(my $j=0; $j<5; ++$j) { $p->nextFrame(); $i->moveTo($j*200*$toggle, 0); $i->rotate(15*$toggle); } $p->nextFrame(); my $j = $m->add($p); } ################################################################ __END__