Posting Flash Form values to Server Side

February 16, 2007

After trying for some half an hour I finally solved the problem of posting values from flash to PHP. I used LoadVars Object for this purpose. LoadVars object is used for transffering values between Flash and Server. It has various properties, methods and events which also helps in determining the successful data loading and communication between server.

In flash you can create LoadVars in following way

var loadVarObj = new LoadVars();
loadVarObj.firstName = “Vijay”;
loadVarObj.lastName = “Khambalkar”;
loadVarObj.skills = “PHP, ASP, Coldfusion, Flex, Javascript”;

This is how your typical loadvars code will look like in case when you need to post values to server side. I found it interesting and thought to share.

One more thing I noticed about the loadVarObj documentation
public send(url:String, target:String, [method:String]) : Boolean

But this part didnt work, you need to event pass object itself as a second parameter. Only then your values is get posted. This is problem where I stuck initially.

Hope this much information will help you.