Here's what I've got for my script, and as you can see, for the most part it's the same as what the CF Application Wizard generates.
<mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent ;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
private var lso:SharedObject;
private function initApp():void
{
this.lso = SharedObject.getLocal("auth");
if( this.lso.data['email'] != null )
{
this.email.text = this.lso.data['email'];
this.rememberLogin.selected = true;
}
if( this.lso.data['password'] != null )
{
this.password.text = this.lso.data['password'];
this.rememberLogin.selected = true;
}
}
private function isValid():Boolean
{
var emailValidResult:ValidationResultEvent = this.emailValidate.validate(this.email.text);
var pswdValidResult:ValidationResultEvent = this.pswdValidate.validate(this.password.text );
if (emailValidResult.type==ValidationResultEvent.VALID
&& pswdValidResult.type==ValidationResultEvent.VALID)
{
return true;
}
else
{
return false;
}
}
private function authenticateUser():void
{
if( isValid() )
{
authManager.login( this.email.text, this.password.text );
}
}
private function errorMessage(msg:String):void
{
//Alert.show( ObjectUtil.toString(event.message) );
this.errorMsg.text = msg;
this.errorMsg.height = 15;
this.errorMsg.visible = true;
}
private function serverFault(event:FaultEvent):void
{
errorMessage( event.message['message']);
}
private function login_result(event:ResultEvent):void
{
// login successful, remember the user.
if( Boolean(event.result) )
{
if( this.rememberLogin.selected )
{
this.lso.data['email'] = this.email.text;
this.lso.data['password'] = this.password.text;
}
else
{
this.lso.data['email'] = null;
this.lso.data['password'] = null;
}
this.dispatchEvent( new Event('loginSuccessful') );
}
else
{
// login didn't work. show message
errorMessage("Login unsuccessful");
}
}
]]>
</mx:Script>
In the login_result function it's checking the boolean result from the RemoteObject, yes? So how come when the remoting returns FALSE it still goes through? Any ideas?
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

