PDA

View Full Version : Actionscript/ASP


Scotlad
01-08-2007, 12:13 PM
Hi, im trying to send data to an ASP that should write it to an XML. But it`s not playing ball. Is it my actionscript or the asp code thats in err?


Actionscript:
function submitQuestion() {
_root.layout.checkTXT.text = "submitting..";
var xmlSubmit:LoadVars = new LoadVars();
xmlSubmit.questionText = strQuestionText;
//xmlSubmit.arrObjects = arrObjects;
xmlSubmit.bgImage = bgImage;
var getxml_lv:LoadVars = new LoadVars();
getResponse.onLoad = function(success) {
if (success) {
_root.layout.checkTXT.text = "submitted!";
loadXML();
} else {
trace("xml did not update");
}
};
xmlSubmit.sendAndLoad("http://127.0.0.1/writexml.asp", getResponse, "POST");
}

Asp:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%/*http://www.actionscript.org/forums/showthread.php3?t=798038*/%>
<%
if (Request.Form("submit") == "true")
{
//Declare variables for the File System Object and the File to be accessed.
var objFSO, objXMLFile;

//Create an instance of the the File System Object and assign it to objFSO.
objFSO = new ActiveXObject("Scripting.FileSystemObject");

//Open the file
//Set objTextFile = objFSO.OpenTextFile("C:\InetPub\PR86027\samples\textfile.txt")
objXMLFile = objFSO.CreateTextFile(Server.MapPath("xmlfile.xml"), 2);

objXMLFile.write(Request.Form("questionText"));
objXMLFile.write(Request.Form("bgImage"));
//Close the file.
objXMLFile.Close();
Response.Write("success=true<br>");
Response.Write(Request.Form("questionText"));
Response.Write(Request.Form("bgImage"));
}
else
{
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Flash Edit XML</title>
</head>

<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">
<param name="movie" value="DropAndDrag_layouBGversiontCREATOR.swf">
<param name="quality" value="high">
<embed src="DropAndDrag_layouBGversiontCREATOR.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed>
</object>
</body>
</html>
<%
}

%>