Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : LoadVars() and ASP problem



dsvsadvas
2/21/2004 8:10:26 PM
Hi,

I'm sending some data from Flash to an ASP page using the loadVars() Post
method and sometimes the data is not passed to the ASP page correctly. (This
happens alot in Netscape 6 with Flash player 6.21) The ASP page doesn't
receive any values and content-type from Flash when this problem occurs. Has
anyone ran into problems with passing data to ASP using the loadVars()
According to Macromedia one way to work around this problem is to manually set
the content-type on the serverside. I have no idea how to do this. Can someone
help me?

Here is my actionScript code:

formData = new LoadVars();
formData.shoppingCart.toString(); //converts an array into a string
formData.euroSubTotal= numberToDisplayString(tempEuro);
formData.sfrSubTotal= numberToDisplayString(tempSfr);
formData.language=lang;
formData.send("checkout.asp","_blank", "post");

on the server side I use the Request.form method to retrieve the variables
inside formData.

Thanks for your help
ShadowKnyte
2/22/2004 11:48:59 PM
You really should look at an XML solution rather than LoadVars(). It keeps your
data in a structured format and is easier to send and load between ASP and
Flash. Worked first time I tried it and saves a lot of headaches when you are
trying to send a lot of information - love XML!
ShadowKnyte
2/22/2004 11:50:12 PM
In your ASP page to send XML set the response type to:

[b]Response.ContentType = "text/xml"[/b]
Jim Esteban
2/23/2004 3:40:29 AM
I'm curious about this line.
formData.shoppingCart.toString(); //converts an array into a string
Is shoppingCart a variable that you passing?

By the way I ran into a suggestion by a senior member that suggested that a
lot of people have trouble with variable caching in flash data transfers. He
suggested that people will attach random letters to the end of a url in perhaps
a query string to force pages to refresh. I haven't tried it but I'm just
throwing it out because I've been battling with a load problem for several days
now and what you're up against is not any easy thing to solve.
AddThis Social Bookmark Button