Posting Flash Form values to Server Side

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”;
loadVarObj.send(URL,loadVarObj,”POST”);

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: