Hi, here is a cheap way to get in on Flash. One of the big drawbacks, with Flash/Perl was the inability to add audio. Well I found a hack. :-) So here is a self-documenting Perl script to create a flash slideshow, with optional audio, from a directory full of jpg's. Here are a couple of samples.... slides.swf and slides-w-audio

Disclaimer: Not responsible for any lost productivity. :-)

#!/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?downl +oad # 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 = <pics/*.jpg>; #//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__

In reply to Flash slideshow with audio by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.