Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: 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
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);

my($font,$movie,$text);


SWF::setScale(1.0);

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

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

$movie->add($text);

$movie->save("/path/to/SWFtest.swf");

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/00_basic....ok
t/01_shape....ok
t/03_movie....ok
t/button......ok
t/drag........ok
t/fill........ok
t/filljpeg....Test header seen more than once!
t/filljpeg....FAILED tests 1-2
         Failed 2/2 tests, 0.00% okay
t/gradient....ok
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
t/sprite......ok
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%  
okay.
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.


In reply to Flash graphics with perl: installing ming by Sol-Invictus

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (18)
    As of 2014-10-30 14:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (208 votes), past polls