NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP and Flash

Mark Armendariz nyphp at enobrev.com
Fri Jun 18 04:12:26 EDT 2004


> Yes, I mean I can insert 4 pictures in the DB, then this tool 
> can generate this Flash movie right way.
> Is it possible?

It is possible to generate a movie with the images in it using the ming
extension:
http://ming.sourceforge.net/
http://www.php.net/ming

But it can be pretty tedious, and ming is still in an early beta.  Also, to
have it programmatically compile the movie on every load could prove to be a
bit heavy.

I'd recommend your server's file system.  Create a cms of sorts for the file
management (file upload, maybe ImageMagick for resizing / cropping), store
the image locations in a db (or not) then generate some output for flash to
pickup the image urls either by using the db query or just a directory
listing of you uploaded images dir.

If you're just going the directory route, you could even ftp the files up
and just use php for outputting the filenames and locations.

If it's only 5 images you could use loadVariables:
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictiona
ry/actionscript_dictionary425.html

And output the image names in a php script something like:
&image_url=http://www.example.com/images/&image1=image_1.jpg&image2=image_2.
jpg&image3=image_3.jpg&image4=image_4.jpg&image5=image_5.jpg

Then once the image names (and location) are loaded into the movie, you can
use loadMovie to load that actual images into your swf:
http://www.kirupa.com/developer/mx/loading.htm

If you plan on sending more stuff from your php backend, I'd recommend
looking into learning about using xml with flash.  Then you would just
output the vars into an xml format and let flash do it's xml magic (it can
be a feat to learn at first, but very powerful once you 'get it').
http://www.macromedia.com/devnet/mx/flash/articles/tools_xmlobject.html

Basically, there's a lot more to learn on the flash side than on the php
side.  PHP would be your gateway to the data and format it whichever way
flash needs to read it.  All the real magic would be in flash itself.

Good luck!

Mark




More information about the talk mailing list