actionscript 3 - Sending vars from a classic ASP page to Flash using AS3? -
i having bit of trouble retrieving variables asp page. returns entire page whereas need variable stranswer page. please help?
here code:
var loader:urlloader = new urlloader(); loader.addeventlistener(event.complete, ondatasaved); loader.dataformat = urlloaderdataformat.variables; var request:urlrequest = new urlrequest("http://" + host + urlpath + "setxml.asp"); request.method = urlrequestmethod.post; var variables:urlvariables = new urlvariables(); variables.xmlstring = str; variables.eltguid = eltguid; request.data = variables; loader.load(request); private function ondatasaved(e:event):void { var loader2:urlloader = urlloader(e.target); loader2.dataformat = urlloaderdataformat.variables; trace(loader2.data.stranswer); }
asp page:
<%@language="vbscript" codepage="65001"%> <% response.cachecontrol = "no-cache" response.addheader "pragma", "no-cache" response.expires = -1 %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1 /dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>setasp</title> </head> <body> <% dim xmlblock, streltguid, objrql xmlblock = escape(request.form("xmlstring")) streltguid = request.form("eltguid") '--------------------------- 'post reddot cms via rql '--------------------------- set objrql = server.createobject("rdcmsasp.rdpagedata") objrql.xmlserverclassname = "rdcmsserver.xmlserver" xmldata = "<iodata loginguid=" & chr(34) & session("loginguid") & chr(34) & " format=" & chr(34) & "1" & chr(34) & " sessionkey=" & chr(34) & session("sessionkey") & chr(34) & "><elt translationmode='0' extendedinfo='' reddotcacheguid='' action='save' guid='" & streltguid & "' pageid='' id='' index='' type='31'>" & xmlblock & "</elt></iodata>" 'response.write(xmlblock) 'response.write(streltguid) objrql.serverexecutexml xmldata, rqlerror if rqlerror <> "" response.write rqlerror else stranswer = "strresponse=just test! how strange. ..." response.write (stranswer) 'response.write "strresponse=just test! how strange. ..." 'response.write "saved successfully." '"saved successfully." ' end if 'response.write "strresponse=just test! how strange. ..." '------------------ 'be citizen '------------------ set objrql = nothing %> </body> </html>
you creating , loading html page. if remove of html tags , use response.write output variable, should work.
i used lot in past load dynamically generated xml asp flash. have blog post here: http://www.herrodius.com/blog/18
Comments
Post a Comment