Re: php arrays into flash
| From: | Miles Thompson | Date: | Mon, 07 Jul 2003 23:49:47 +0000 |
| Subject: | Re: php arrays into flash | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154277@lists.php.net to get a copy of this message | ||
Jim,
The key words are "implode" on the PHP side and "split" on the Flash side. Here's an example:
The data is returned from PHP like so, after doing the connect, select, etc. to produce an array of 7 dates for back issues ... no claim that this is optimal code.
if( $result && mysql_num_rows( $result ) >= 1 )
{
while( $row = mysql_fetch_array( $result ) )
{
$arrdates[] = $row[ dtStory ];
}
$issuedates = implode( ",", $arrdates );
}
echo "issuedates=".$issuedates;
and in Flash, as part of the LoadVars varGetDates.onLoad = function( success) callback is handled like so ...
_root.arrIssueDates = issuedates.split( "," );
_root.dtDate = _root.arrIssueDates[0];
for (i=0; i < arrIssueDates.length; i++)
{
//load combo-display and data same in this case
cboIssueDates.addItem(arrIssueDates[i],arrIssueDates[i]);
}
At 06:29 PM 7/7/2003 -0500, Jim McNeely wrote:
I know a lot more about php than about flash (which is probably sad) but does anyone know how to take info in an array and pass it into an array in flash? I think they have arrays, but the only thing I can seem to find in flash to get info from php is the loadvariable actionscript step. I looked around via google and I couldn't find anything within a reasonable time that seemed to answer this question. TIA Jim McNeely Envision Data jim@envisiondata.com http://www.envisiondata.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php