This content has been marked as final. Show 3 replies
I'm afraid I don't really understand what you're trying to do with the bridge.php script. I can't see it doing anything with variables received from flash via getURL. There is no access to the $_POST array in your script.
LoadVars cannot send complex data types without encoding it in some way so you should assign all those values as properties of the LoadVars instance itself and not try to reference an array from a property of LoadVars (id).
So it would be more like:
myvar.txt_1 = colortext;
myvar.txt_2 = xheight;
when those are received by the php script they would be accessible in the $_POST array like:
And, as a side note, in actionscript Arrays are not intended to be used in that way assign properties as an associative array. Its best to use a generic Object instance to do that.
Thanks for the input
I think I am on the right track now.
I did not include any $_POST declarations because I have register globals turned on.
I will include then however since its good coding practice and register globals is now deprecated.
Thanks again for your help.
I've never used register globals, couldn't figure that out, thanks for explaining.
The other way to do it if you want to send an array of simple data (usually all of one data type like string or number) is to use array.join("delimiter_sequence"); in flash. You can then assign it to a single property of your loadvars (e.g. 'id') and use explode in php with the same delimiter to recreate an array. This does not give you an associative array though, just a regular numeric indexed one.
To send complex data like arrays and objects, you can use other encoding techniques. You can even use json: json.org has a json class(es) for flash and php 5 has json encoding/decoding support for example.
Another way is to use amfphp and remoting, which does all the work for you. And of course, you have XML support as well at both ends, so you can always represent complex data in XML if you prefer. You may want to investigate these or other methods on future occasions.