all groups > flash data integration > june 2007 >
You're in the

flash data integration

group:

Getting data from MySQL


Getting data from MySQL themolotov
6/15/2007 12:00:00 AM
flash data integration: I'm a web developer that is familiar with PHP and MySQL. I just started working
with a guy who has created a site in Flash for a client, and I've created the
backend in PHP. It was understood that all I'd have to do would be to PUT
information into the database and he'd pull it out on the site. Things have
changed and I've been asked to pull the data down for him.

I've Googled to find out that it's possible to get data from MySQL into Flash
via a textfile formated as such: 'myVar=[data]'. I don't know the specifics,
but I can figure that all out. However, I have two particular questions
regarding the data:

[b]1.)[/b] How does Flash handle HTML formatting? The CMS I've written allows
an administrator to input plain HTML and I store that in the database; how will
that translate into Flash? Does Flash have an HTML parser? I've been having
trouble filtering through searches on Google about using HTML to put Flash on a
page instead of Flash parsing HTML. I read on another forum that Flash has an
HTML 1.0 parser, but the post was dated August 2003.

[b]2.)[/b] I've also been storing images as BLOBs in MySQL. How do I go about
pulling these images out? Of the tutorials I've found on Google, all I can hit
with my searches are scenarios in which people store image [i]paths[/i] in the
database, and output them in the same textfile, 'myImage=/images/image.jpg'
etc.
[url=http://forums.devarticles.com/web-development-40/flash-mysql-longblobs-9659
..html]This unanswered forum post off-site[/url], is similar to what I'm trying
to do, but I'd need to display many images in a flash movie and I don't think
passing them via src would work.

I'm not necessarily asking for complete solutions for these problems, I just
need to be pointed in the correct direction, maybe a function or a document I'm
missing.
Re: Getting data from MySQL MotionMaker
6/15/2007 5:32:57 PM
1. Flash TextFields can handle a limited amount of HTML:
http://livedocs.macromedia.com/flash/8/main/00001459.html. The .html property
is enables HTML rendering and .htmlText property for asssigning the HTML.
2. Your PHP scripts cannot send back HTML. They can send back data either in
URL Encoded format or XML. That means your script is only echoing data. The
HTML can be stored in data such as a URL variable or in CDATA node of XML.

3. You will need your PHP script to create a temporary jpg file on the server
and send to Flash the name of the file. Then you use either MovieClip.loadMovie
or MovieClipLoader to fetch the jpg on the Flash side. There should be links on
the web for the PHP part handling the filenaming and the garbage collection.

Re: Getting data from MySQL themolotov
6/15/2007 6:01:25 PM
[q][i]Originally posted by: [b][b]MotionMaker[/b][/b][/i]
1. Flash TextFields can handle a limited amount of HTML:
http://livedocs.macromedia.com/flash/8/main/00001459.html. The .html property
is enables HTML rendering and .htmlText property for asssigning the HTML.[/q]
Those tags would probably be fine. We're not trying to do anything fancy.

[q]2. Your PHP scripts cannot send back HTML. They can send back data either
in URL Encoded format or XML. That means your script is only echoing data. The
HTML can be stored in data such as a URL variable or in CDATA node of XML.

Ex for URLVars: echo theHtml=<p>This is[B]bold[/B]</p>&var2=1234&var3=true;[/q]

Ok, that's what I thought.

[q]3. You will need your PHP script to create a temporary jpg file on the
server and send to Flash the name of the file. Then you use either
MovieClip.loadMovie or MovieClipLoader to fetch the jpg on the Flash side.
There should be links on the web for the PHP part handling the filenaming and
the garbage collection.
[/q]

Uhg, that's what I also thought, and was afraid of. You told me everything I
need to know I think. Thank you.

AddThis Social Bookmark Button