SWF>ASP>TXT and TXT>SWF
Following on from AS: PHP & Flash by shazwoogle and AS: Load External Data/Cross-Domain, this is the version for users of ASP. ASP is short for Active Server Pages, and it basically allows for dynamic content on the web. A very simple example of ASP code:
<% Response.Write("Hello, Mother!") %>
Generally ASPages pull from and write to an MSAccess database, but this is another use for them - writing through them from Flash to a textfile.
The ASP version uses basically the same AS and symbols as shazwoogle's PHP example - 2 Input Textboxes with the VAR names tname and info (for sending), 2 Dynamic Textboxes with the VAR names tname2 and info2 (for receiving), and a button InstanceNamed submit
Code on the first (only) frame is:
var path = "http://sitename.com/folder/" //FOLDER
var myData:LoadVars = new LoadVars();
info = "";
tname = "";
submit.onPress = function() { //SEND DATA
if (tname != "" && info != "") {
myData.info = info;
myData.tname = tname;
info = "";
tname = "";
myData.sendAndLoad (path + "gb.asp", myData, "POST");
}
};
myData.onLoad = function() { //LOAD FROM TXT
info2 = this.info; tname2 = this.tname;
};
myData.load (path + "gb.txt"); //LOAD TXT ON STARTUP
The ASP code is (obviously) a bit different from PHP:
<%
'Prepare file for write, use TF = 8 for appending
Const TF = 2
Dim oFSO, oTS, nam, inf
Set oFSO = Server.CreateObject ("Scripting.FileSystemObject")
nam = "&tname=" & Request.Form("tname")
inf = "&info=" & Request.Form("info")
'Open textfile.
'Use ( Server.MapPath("gb.txt"), fsoForAppend) for appending
Set oTS = oFSO.OpenTextFile( Server.MapPath("gb.txt"), TF, True)
'Write to textfile
oTS.WriteLine "k=3" & nam & inf
'Clean up
oTS.Close
Set oTS = Nothing
Set oFSO = Nothing
%>
==================
PHP has an advantage over ASP in terms of cost. Since the majority of webhost services run on Unix/Linux machines, and ASP requires a Windows-based server, you'll generally find that ASP-enabled domains cost a bit more than PHP-based ones. Personally, I have 2 domains with http://www.easyasphosting.com/ ($4.99/month) and have been very satisfied with their service and support.
In terms of free ASP domains, try here and here
==================
Associated reading:
http://www.webhostdir.com/guides/asp/
http://www.4guysfrom..temObject/faq3.shtml
http://www.w3schools.com/asp/
Flash/ASP scoreboard
AS: Load External Data/Cross-Domain
Cross-domain policies