Here’s a Login sample app (rename to
samples.zip) that uses the RemoteObject.setRemoteCredentials(username,
password) and the ColdFusion CFLOGIN container. Unzip it
to your web server’s doc root. In flex builder create a new Flex
project of type “ColdFusion Flash Remoting Service”. Fill out
the prompts and specify “LoginTest.mxml” as your Main application
file. Here’s a code snippet from the app
and it breaks down like this In the MXML …
private function logIn():void
{
// all this does is set the credentials - these are not sent over until the
first actual request is made
// set the RemoteObject
cf.setRemoteCredentials(this.username.text, this.password.text);
loginbtn.enabled = false;
logoutbtn.enabled = true;
}
private function logOut():void
{
//Alert.show("logout");
loginbtn.enabled = true;
logoutbtn.enabled = false;
cf.setRemoteCredentials(null, null);
cf.logout();
cf.logoutuser();
} … …
<mx:FormItem direction="horizontal">
<mx:Button id="loginbtn" label="Login"
click="logIn();"/>
<mx:Button id="logoutbtn" label="Logout"
click="logOut()" enabled="false"/>
</mx:FormItem> The CFML included in the app uses the
CFLOGIN structure as per CF best practices of usage of this feature. Also note that as part of the new Super
Wizard for Flex Builder 2.0 produced by the CF team includes an option to
build-in a login scheme (includes a well-formatted login page with user name
and password field prompts and the appropriate cfc backend logic). Bill From: On Thursday 18 May 2006
17:52, s_hernandez01 wrote: |
samples.piz
Description: samples.piz