Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendAndLoad problem

Status
Not open for further replies.

snakehips2000

Programmer
Nov 10, 2003
95
GB
I'm a Flash novice and am trying to replicate the Login sample shipped with Flash 8 by using SendAndLoad to pass the username and password variables to an ASP file on my local testing server as my website is not yet up and running. Can I do this?

I'm running IIS 5.0 and have the .fla, .swf, .htm, .mdb (Access database), and .asp files all in the following folder:

D:\Inetpub\
I've tried the following but when I run my compiled Flash movie from a browser (i.e. using the .htm file), I'm unable to retrieve records that I know to be in the database.

login_lv.sendAndLoad(" result_lv, "POST");

I've checked the syntax of the ASP file and all seems to be OK, including the ADO /SQL statements.

I've developed my site with Dreamweaver and configured my "Testing Server" as follows:

Testing Server Folder - D:\Inetpub\URL Prefix -
Any help appreciated.
 
No errors. The ASP page seems to be doing its job as it returns a value when the page is viewed in a browser.Its just that the value isn't what I know to be correct. Here's the page:

<%@Language=Vbscript%>
<%Option Explicit%>
<%
'''''''First, get the stuff from flash
Dim inUserName, inPassword
inUserName = Trim(Request("username_ti"))
inPassword = Trim(Request("password_ti"))

'''''''Now, create the connection object
Dim myConnection
Set myConnection=Server.CreateObject("ADODB.Connection")
myConnection.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("Membership.mdb")
myConnection.Open

'''''''Here is our SQL statement when we open the Recordset
Dim loginSQL
loginSQL = "SELECT * FROM Members WHERE Username = '" & inUserName & "'"
'''''''Create, and open the Recordset
Dim myRS
Set myRS=Server.CreateObject("ADODB.Recordset")
myRS.Open loginSQL, myConnection

'''''''Make sure we have some data, if we do, make sure the password matches
Dim mainMessage
response.write inUserName
If myRS.EOF Then
mainMessage="userInfo=false"
Else
If(StrComp(myRS("Password"), inPassword, vbTextCompare) =0) Then
mainMessage="userInfo=true"
Else
mainMessage = "userInfo=false"
End If
End If
'''''''Clean up everything
myRS.Close
Set myRS=Nothing
myConnection.Close
Set myConnection=Nothing

'''''''Now send the data back to flash
Response.Write(mainMessage)
%>

I expect to see the value "userInfo=True" to be returned but instead I get a value of "userInfo=False", even though I know there is a value in the access database matching the input text values in the Flash input textboxes named username_ti and password_ti. In fact, the "userInfo=False" return value gets triggered because the myRS.EOF property is returning True. That shouldn't be the case as I know that the SQL statement ""SELECT * FROM Members WHERE Username = '" & inUserName & "'" is accurate.
 
u have to output it like this:
Code:
'''''''Now send the data back to flash
    Response.Write("&mainMessage="& urVar)
then in flash:
Code:
var lv = new LoadVars();
lv.onLoad = function(success){
    if(success){
        trace(lv.mainMessage);
    }else{
        trace("Error Loading");
    }
};
lv.sendAndLoad("urPage.asp", lv, "GET");

Regards,

Martin

Computing Help And Info:
 
Tried your suggestion but the Trace returns "undefined". I'm suspecting that the problem lies somewhere between the SendAndLoad function in Flash passing the 2 text input values and them not being read correctly by the ASP file:

In summary, I have,
In Flash:
var result_lv:LoadVars = new LoadVars();
var login_lv:LoadVars = new LoadVars();

login_lv.username = username_ti.text;
login_lv.password = password_ti.text;

//both these traces return the inputted text
Trace(login_lv.username)
Trace(login_lv.password)

login_lv.sendAndLoad(" result_lv, "POST");

and ...

In ASP:
<%@Language=Vbscript%>
<%Option Explicit%>
<%

Dim inUserName, inPassword
inUserName = Request("username")
inPassword = Request("password")

//the following statements do not return anything from the browser.I would have expected to see the same values I saw via the Trace statement in Flash?

Response.Write(inUserName)
Response.Write(inPassword)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top