Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / March 2007



Tip: Looking for answers? Try searching our database.

complex data types from PHP to Flash

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sneakyimp - 08 Apr 2006 00:47 GMT
Does anyone know of any really easy and effective ways to move complex data
types from PHP into FLASH and vice-versa?  A while back I made an attempt to
recreate PHP' serialize() function in actionscript but it was really difficult
and performance was poor.

I'm able to do it fairly easily for one dimensional arrays indexed by numbers,
but when I have to pass either an object (or several objects) or when i have to
pass a nested array of arbitrary complexity (such as a data tree) then I get
bogged down.

I have a little experience dealing with XML in flash (working with the tree
component) but it seems like so much effort when i am dealing with a new data
type.

Does anyone know of any pre-packaged components or code (in actionscript and
complimentary part in php) that might be useful?
sneakyimp - 11 Apr 2006 03:28 GMT
look no further, interested parties:

http://amfphp.org

in the meantime, if anyone can answer this question, i would appreciate the
help...


http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=288&thre
adid=1141488&enterthread=y
mae ling - 09 Jun 2006 13:42 GMT
Hi,
I also read your other post. I saw you were going into the wrong direction.
So, how to put data into a grid from mysql ?

- be sure to have the datagrid and remoting classes into your swf library.
- make a service  (php file you put in the services directory of AMFPHP). Be
sure your file has the same name as
the class you're putting inside.

Then, simply make a sql request like this :

function fill_grid()
        {
                $sql4 = sprintf("SELECT blabla AS product, mlkdmf AS hihi,
etc..
                                 FROM users AS u, etc..
                                 WHERE   ...join tables if you need...
                                 AND ... the necessary conditions...");
                                 
                $grid = mysql_query($sql4);
                return $grid;
                NetDebug::trace($grid);
        }

In your flash file :
all the necessary imports for remoting and amfphp, netdebug if you wish. and
the services..
service = new Service(gatewayUrl, null, 'YOUR SERVICE NAME);

function fill_grid() {
    var pc:PendingCall = service.fill_grid();
    pc.responder = new RelayResponder(this, 'handleFill_grid',
'handleRemotingError');
    trace(' test 444');
}

function handleFill_grid(re:ResultEvent) {
    //callback code
    YOUR GRID.dataProvider = re.result;
    trace(' binnen handlefill 4');
}

This is it. Your grid wil be filled with the data from the SQL request. Change
your column names directly in the SQL request with the "AS" parameter, so
they'll appear like that in Flash. ex:    "select users AS clients"  will name
your column "clients" in the datagrid.

You can also transfer data in the other way. My project consists of a grid
filled with MySQL data, and three comboboxes
that can filter that data. I'm not filtering the data in the grid, but I made
a new SQL request and push the selected items in the comboboxes to the service,
and the service uses those values to perform the request.

For more info, check the amfphp site , or wikipedia (
http://wiki.media-box.net/ ) if you know french. You can also use a translator
like babelfish ;)

hope this helps you out ;)

       
mae ling - 30 Mar 2007 09:27 GMT
Just forgot..
Don't forget to execute your function afterwards,
otherwise your grid wil stay empty :p
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.