Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Flash graphics with perl: installing ming

by Sol-Invictus (Scribe)
on Jan 28, 2004 at 11:14 UTC ( #324638=perltutorial: print w/replies, xml ) Need Help??

First things first, you need Ming, available here.

Inside the distro are various wrappers for the library, including a little publicised perl one. Install the perl wrapper using the standard proceedure for perl modules:

perl Makefile.PL
make test
make install

In my case I got some errors see foot note(1) if you like that sort of thing, but I forced the install with no obvious problems. Darwin/OSX users also see foot note (2) for applying a patch to the makefile.

Next, Ming needs a special font definition for each font used (the test script below uses "serif.fdb"). These files can only be generated by (the very expensive) flash editor apps, luckily we get out of catch22 thanks to the author of Perl Graphics Programming, who has a .fdb file on his web site: serif.fdb and the kindness of ming enthusiasts who keep a goodly list here

Now we can start creating our own whistles and bells - but with perl:

#!/usr/bin/perl -w
use strict;
use SWF qw(:ALL);



$font = new SWF::Font("/path/to/serif.fdb");
$text = new SWF::Text();
$text->moveTo(200, 2400);
$text->setColor(0xff, 0xff, 0x99);
$text->addString("It works!");

$movie = new SWF::Movie();
$movie->setDimension(5400, 3600);



Foot notes:

1) Make test output:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"  
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/filljpeg....Test header seen more than once!
t/filljpeg....FAILED tests 1-2
         Failed 2/2 tests, 0.00% okay
t/png.........Test header seen more than once!
t/png.........FAILED test 1
         Failed 1/1 tests, 0.00% okay
t/sound.......Test header seen more than once!
t/sound.......FAILED tests 1-3
         Failed 3/3 tests, 0.00% okay
Failed Test  Stat Wstat Total Fail  Failed  List of Failed
t/filljpeg.t                2    2 100.00%  1-2
t/png.t                     1    1 100.00%  1
t/sound.t                   3    3 100.00%  1-3
Failed 3/11 test scripts, 72.73% okay. 6/26 subtests failed, 76.92%  
make: *** [test_dynamic] Error 2

2) Intsructions for Darwin/OSX patch:

get the patch here

In the terminal make sure the patch, and you, are in the ming directory and type:

'zcat ming-0.2a-mhaque-darwin-jaguar.patch.gz | patch -p0' 

This will patch the makefile to install both dynamic and static ming libs correctly.

  • Comment on Flash graphics with perl: installing ming

Replies are listed 'Best First'.
Re: Flash graphics with perl: installing ming
by teabag (Pilgrim) on Jan 28, 2004 at 15:40 UTC
    Nice one Sol-Invictus,
    I myself, being a crappy cartoonist, use flash for just about everything. The Ming-module is indeed excellent for all my needs.

    For those interested, I found some really usefull additional Ming-Perl info on
    Some (flash 6!) sample scripts and fonts are also provided on

    Also really interesting is FLAP, using flash remoting in Perl.
    Let me also remind you of the trusty SWF-File - brand new version 0.31! and its wrapper SWF-Builder. They too are very handy in scripting SWF movies and produce excellent results. Check my scratchpad to get an slightly funny example involving a camel.

    Kind regards,

    Sure there's more than one way, but one just needs one anyway - Teabag
Re: Flash graphics with perl: installing ming
by zentara (Archbishop) on Jan 29, 2004 at 02:20 UTC
    Hi, try my Flash Japh :-)

    I found that ming went in very easy, and is quite easy to understand, but I couldn't get gif, png or mp3 files to work. Is that because it's still being developed? Or do you have a Perl example of streaming mp3?.

Re: Flash graphics with perl: installing ming
by Anonymous Monk on Jan 28, 2004 at 17:05 UTC
    Nice post, this has given me something intersting to do these long winter months. Thanks.
      Absolutely! I can think of numerous uses and abuses of this cool tool.

      As much as I hate to see web sites done in all-flash, I am very likely going to do this to my home page now....because I can...funky effects everywhere!!! The fact that Chapter 9 on Ming is free, I'll buy the book if it proves useful.

      Looking at this example, it seems to imply Perl-ish callbacks can be used to generate Flash callbacks. I'd love to learn what sort of evil-voodoo was used to accomplish this, I'm really in awe of what might be possible using this module. (And definitely it's a savings from the cost and pain of using the official Flash product).

      I remember using the Macromedia SDK (C++) for a component of a Senior Design project, and this is infinitely more advanced.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://324638]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-07-20 17:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (311 votes). Check out past polls.