Flash Cs3,flex and ASP communication

Source: Internet
Author: User

Flash and asp:
First put two code:
Flash
var loader:urlloader = new Urlloader ();

var url:http://www.111cn.net/flash_a/114/urlrequest = new Http://www.111cn.net/flash_a/114/URLRequest ("test.asp");

Url.method = Http://www.111cn.net/flash_a/114/URLRequestMethod.POST;

var values:urlvariables = new Urlvariables ();

values.message= "Hello im flash!";
Url.data = values;

Loader.dataformat = Urlloaderdataformat.variables;
Loader.addeventlistener (event.complete,loaded);
function loaded (e:event) {
Out1.text=loader.data;
Output:phpmessage=im php Message!&flashmessage=hello im flash!
Out2.text=loader.data.phpmessage;
im PHP message!
Out3.text=loader.data.flashmessage;
Hello im flash!
Out4.text=loader.data.dbmessage;
}
Loader.load (URL);
Asp:
<% @LANGUAGE = "JAVASCRIPT"%>
<%
Receive the data that flash passes in
var flashdata;

Flashdata = Request ("message");
Data sent to Flash
var aspmessage;
Aspmessage = ' im asp message! ';


Database-related Operations
//======================================
var Conn;
var rs;
var sql;
var strpath;
Strpath= "Test.mdb";
try{
conn = Server.CreateObject ("ADODB"). Connection ");
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + Server.MapPath (StrPath);
Conn.Open ();
}catch (e) {
Response.Write (' <meta http-equiv= "Content-type" content= "text/html; charset=utf-8"/><div style= "font-size : 12px;font-weight:bold;border:1px solid #006;p adding:6px;background: #fcc > Database connection error, please check the connection string!</div> ');
Response.End
}
Rs=server.createobject ("ADODB.") Recordset ");
Sql= "SELECT * from name";
Rs.Open (sql,conn,1,1);
//======================================
Response.Write ("phpmessage=" +aspmessage+ "&" + "flashmessage=" +flashdata+ "&" + "dbmessage=" +rs ("CompanyName "));

%>
See the Flash and ASP files when the face variable name to know how each other is transmitted, for some of the database inserts, updates, query operations, as long as the receipt of flash data, directly run the ASP-related database Operations command on the line. You can test it by copying it directly to the path of IIS. View Online Address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.