Solved

XML string from Flash to ASP.NET

Posted on 2006-07-13
1
197 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Firefox video player - embedded native versus VLC player 3 1,065
Stock Videos 17 326
EMET 5.2 / Adobe Flash 2 229
Windows 2008 Group Policy - An error occurred. Please try again later 2 74
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now