PDA

View Full Version : Problem with Flash Remoting and if statement


rbayly
01-19-2003, 02:39 PM
Okay here is fun one , it is probably simple however I cant figure it out

I have a simple login script that is pulling information from a CFML CFC. I know the cfc is right I have tested it and it is returning the right value (1 or 0) but when I base an if statement off of it it wont validate

here

First Include my gateway code.

#include "NetServices.as"
#include "NetDebug.as"

NetServices.setDefaultGatewayUrl("http://68.57.41.42/flashservices/gateway");
var gw = NetServices.createGatewayConnection();
var user = gw.getService("CFC.user", new Result());

then set my default responder

function Result()
{
//receives data returned from the method
this.onResult = function(result)
{
trace(result);
}

this.onStatus = function(error)
{
trace("Error : " + error.description);
}
}


Then on the login page there are two form variables a Username and Password textfield
on press of the login button I set these in an object and go to my next scene.

on (release){
logInfo = new Object();
logInfo.Username = Username.text;
logInfo.Password = Password.text;
gotoAndPlay("LoggingIn");
}



on entering the login clip I call the function and set a variable.

var LoggedIn = user.ValidateUser(logInfo.username, logInfo.password);

it returns properly in the output window (1 or 0)

at the end of the clip I validate for the next clip here is where the problem is.

if (LoggedIn <> 1){
gotoAndPlay("Denied");
}
if (LoggedIn == 1){
gotoAndPlay("SendingToSite");
}
stop();

I tried using an else or just validating Boolean what ever I do it always returns NEQ to 1 even though the output window says 1 ,. what am I doing wrong?

jimburton
01-19-2003, 08:06 PM
maybe coming in as a string...? try loggedIn == "1"