?
Solved

XML string from Flash to ASP.NET

Posted on 2006-07-13
1
Medium Priority
?
237 Views
Last Modified: 2010-04-03
can any experts show me the best approach(es) to send xml from a Flash file (example: a flash based user registeration form to submit first name, last name and email)  to an asp.net page (aspx).  Example please
0
Comment
Question by:musclejack
1 Comment
 
LVL 7

Accepted Solution

by:
furmiga earned 2000 total points
ID: 17106546
Hi there!

Do you really want a xml approach ?

I'm used to send vars to ASP.Net in the usual way:

IN THE FLASH

Make a button and give the instance name: my_send_button
make 3 imput fields with the instance name: first_name, last_name and email

Put this code in the frame:

// creates a new instance of LoadVars
var send_rec:LoadVars = new LoadVars()
// Creates a onRelease function for your button
my_send_button.onRelease = function()
{
      // Populate your LoadVars with the arguments you want to send to the ASP
      send_rec.first_name = first_name.text;
      send_rec.last_name = last_name.text;
      send_rec.email = email.text;
      // Now send the LoadVars to the ASP and Places the response in this same LoadVars
      send_rec.sendAndLoad("http://your_site_here/your_ASP_file",send_rec,"GET");
}
/* After send and recieve ALL variables (or at last tried to), the onLoad function
will be called (This will be automactly called when all done)*/
send_rec.onLoad = function(sucess:Boolean)
{
      // If all good
      if (sucess)
      {
             // This message will be generated by your ASP
            trace(send_rec.final_message);
      }
}

IN THE ASP.NET

<%@ Page Language="VB" debug="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Response.Expires = -1
        Response.AddHeader("Pragma", "no-cache")
        Response.CacheControl = "no-cache"
        Response.AddHeader("Content-Type", "text/html;")
        Dim first_name as String
        Dim last_name as String
        Dim email as String
        first_name = Request("first_name")
        last_name = Request("last_name")
        email = Request("email")
        if (first_name <> "") and (last_name <> "") and (email <> "") Then
            Response.Write("&final_message=Everything is fine&")
        else
            Response.Write("&final_message=One of the fields is blank&")
        End if
    End Sub
</script>

Well thats it. I hope it helps :)



Ralph
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question