Solved

XML string from Flash to ASP.NET

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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.
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.

759 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

23 Experts available now in Live!

Get 1:1 Help Now