Hi there
I'm busy communicating with my Flash file with a PHP script which in turns communicates with my db, I need to pass an array from PHP back to Flash, which happens correctly I assume, but I'm unable to unserialize the string correctly when it returns, my string looks like this:
memberNum=2&success=1&teamMemberID%5B0%5D=1&teamMemberID%5B1%5D=2
I use this data by using the com.frigidfish.FlasPHP
package I got from here: http://www.as3blog.org/?p=18.
My problem is however here:
function processPHPVars(event:Event){
// put the object that php sends back into a var (in this case phpData)
phpData = event.target.receivedVars;
if (phpData.success) {
trace(phpData.memberNum);
// I'M STRUGGLING HERE TO TRACE THE CORRECT VALUE FOR THIS ARRAY
trace(phpData.teamMemberID[0]);
}
}
I keep getting the following error:
TypeError: Error #1010: A term is undefined and has no properties.
The whole AS3.0 section looks like this:
import com.frigidfish.FlashPHP;
var memberNum:Number = 0;
var teamMemberID:Array = null;
var phpData:*;
var memberNumObject:Object = new Object();
memberNumObject.memberNum = memberNum;
memberNumObject.teamMemberID = teamMemberID;
var flashPHP:FlashPHP = new FlashPHP("http://www.strikeproductions.co.za/team_getMembers.php", memberNumObject);
flashPHP.addEventListener("ready", processPHPVars);
function processPHPVars(event:Event){
// put the object that php sends back into a var (in this case phpData)
phpData = event.target.receivedVars;
if (phpData.success) {
trace(phpData.memberNum);
trace(phpData.teamMemberID[0]);
}
}