PDA

View Full Version : php->flash & arrays, and drawing dynamic graphs


Thitinan
10-13-2005, 12:04 AM
Hi

I have two questions:

1. Suppose I have a php file that have just executed

$query = "some mysql query";
$result = mysql_query($query);
$sarray = mysql_fetch_array($result, MYSQL_NUM);

Where the array should be an array of integers representing all the rows from the query (1 column, 50 rows).

My question is:

how do i return this array into my flash file?

Will 'print "nameofarrayinflash=sarray[sarray]";' work? I'm not quite sure how that function works when it comes to arrays, as I only know how to use it when it comes to single variables.

2. I'm trying to draw a line/bar graph in my movie (which uses that array). Some people pointed me to FusionCharts lite, and I have been looking into that. However, it seems as though FC requires a php/html to start the process of loading a pre-specified .swf.

So with what I'm working on, I already have my flash file, I'm wondering if it's possible for me to use FC graph in my file; As in load a .php file inside and have it execute the command to load the FC's .swf charts.

I hope that all makes sense, help would be greatly appreciated as I'm on an urgent deadline

Thanks in advance.

Jesse
10-14-2005, 02:47 AM
Hi mate.

1.
See the AMFPHP Remoting Tutorial. That would be the absolute best way to do it.

Failing that you can use XML or loadVars/LoadVariables. In each case you would make the Flash call the PHP file and the PHP does its query then prints out the results, in an XML structure or in a formatted text string which can be read in by LoadVars objects.

2.
No idea. Might be better posting that as a separate question with the name of the components in the title so people familiar with the product notice it.

Good luck.

Jesse
10-14-2005, 02:59 AM
Note that the above post was my 8000th. Fitting that it should answer a question for a guy I went to school with :)

mullwaden
11-13-2005, 10:25 AM
I've been trying to do this aswell, im pretty stuck though. Can i see your stuff ? =)

squimmy
11-17-2005, 04:51 PM
I have just done something similar to that. I used the sephiroth class:
http://www.sephiroth.it/test/unserializer/index.php

A good tut is here:http://forums.dreamincode.net/showtopic9848.htm



Good luck:)

mullwaden
11-19-2005, 01:05 AM
Woah nice stuff, makes life allot easier buuuuuuuut.... :D

uhh now that i have som numbers in some serialize thing, ofcourse risking sounding very stupid, how do i use them, say put them in an array in flash =) I have an array called nums how do i get the numbers into it ?

//cheers

p.s. while im at it, how do i see the amount of values in an array, is it something like array'last ? (thats the ADA version) :S