http://qs1969.pair.com?node_id=286693


in reply to Re: Perl Talking to Flash
in thread Perl Talking to Flash

Talking together. A Perl Program sending swf, xml and jpg to a Flash Player, and a Flash Player returning XML to a Perl program. Sorry if I was vague.

Replies are listed 'Best First'.
Re: Re: Re: Perl Talking to Flash
by thinker (Parson) on Aug 26, 2003 at 13:29 UTC

    Hi Arbogast,

    Have you seen ming. A C library interface to flash with a Perl interface. ( Does that sound right!?)

    NAME SWF: an autoloadable interface module for Ming - a library for +generat- ing SWF ("Flash") format movies. + SYNOPSIS # Don't import other modules use SWF; or use SWF(); + # import all SWF modules use SWF qw(:ALL); + # import SWF::Shape and SWF::Movie only. use SWF qw(Shape Movie); + DESCRIPTION By default, SWF doesn't import other SWF classes. You may, howe +ver, instruct SWF to import all modules by using the following synta +x: use SWF qw(:ALL); METHODS SWF::setScale($scale); Sets scale to $scale. + SWF::setVersion($version); Sets SWF version. Only versions 4 and 5 are currently suppo +rted. + AUTHOR Soheil Seyfaie (soheil@netcom.ca). + SEE ALSO SWF, SWF::Action, SWF::Button, SWF::Action, SWF::Bitmap, SWF::B +utton, SWF::DisplayItem, SWF::Fill, SWF::Font, SWF::Gradient, SWF::Mor +ph, SWF::Movie, SWF::Shape, SWF::Sound, SWF::Sprite, SWF::Text, SWF::TextField.

    Hope this helps

    thinker

Re: Re: Re: Perl Talking to Flash
by thunders (Priest) on Aug 26, 2003 at 13:39 UTC

    the loadVariables ("url" ,level/"target" [, variables]) method in Actionscript can be used to pull information from environmental variables. I'm not sure if Flash could handle binary information like a .jpg file with this method, but i imagine you could use this to save information to a file and pass the filename to the script with loadVariables.

    Flash has native XML handling in the latest version, look at the XML object that provides XML.send, XML.load, and XML.sendAndLoad methods, I've never used that feature, but I imagine there are examples on the net on the proper way to send XML over HTTP in flash.

Re: Re: Re: Perl Talking to Flash
by benn (Vicar) on Aug 26, 2003 at 13:27 UTC
    Ahhh - gotcha!

    With the proviso that I know next-to-nothing about Flash, presumably you can use exactly the same mechanism to communicate locally as you do with a webserver. If your perl program uploads files to the server's filesystem ready to be read by Flash and vice-versa, you can simply write out to local files instead. If you're using sockets to communicate(?!), then the process will be the same as it is already, but replacing the remote port with a local one.

    Cheers, Ben.

      Thanks Ben. I am guessing I should carefully read Network Progamming in Perl by Lincoln Stein??? Sounds like I have a doable problem.

      On Ming, I have used Ming, it is good. But, the version I have only covers through Flash 5, and it isn't complete I believe. Plus, it doesn't have a nice graphical tool to use Ming.

      Title edit by tye

Re: Re: Re: Perl Talking to Flash
by Arbogast (Monk) on Sep 07, 2003 at 14:29 UTC
    Update on solving the problem. I haven't worked on getting it working in Linux. Seems logical this would work under Linux

    But an extremely simple solution on Windows was to install the Windows Version of Apache and let Perl and Flash communicate through Apache on 127.0.0.1

    I like Tk, but Flash sure is a far more attractive local GUI over Perl/Tk for many things. Without doubt, the Perl Man is a genius compared to the lovely Miss Flash. They make a lovely couple.