
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 1.31 KB | hits: 11 | expires: Never
Communation between ASP.Net and Flash CS5
<embed height= "500px" type="application/x-shockwave-flash" width="500px" src="../Untitled-3.swf" fullscreen="no"></embed>
btn.addEventListener(MouseEvent.MOUSE_DOWN,senddata);
function senddata(e:MouseEvent)
{
var scriptRequest:URLRequest = new URLRequest("../WebForm1.aspx");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();
scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
scriptVars.var1 = "one";
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
function handleLoadSuccessful($evt:Event):void
{
txt.text="sent";
trace("Message sent.");
}
function handleLoadError($evt:IOErrorEvent):void
{
txt.text="failed";
trace("Message failed.")
}
}
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.Form["var1"] != null)
{
TextBox1.Text = Request.Form["var1"];
}
}
}
TextBox1.Text = Request.Form["var1"];