[flexcoders] Re: geting info of a user who has loged in

2009-01-12 Thread johndoematrix
am sorry for sounding naive and inexperienced, but i am stack. i have
read thru all the solutions suggested but have failed. please can
someone help with a small tutorial on how to do this. i know am asking
for too much but please help. thanks



RE: [flexcoders] Re: geting info of a user who has loged in

2009-01-12 Thread Tracy Spratt
We will not write your application for you.  Well I will, at my hourly
rate, contact me off list if you want to hire me.

 

If you want any more help from me you will need to show what you are
doing.

 

To start with, post your login HTTPService declaration code and your
result handler code. 

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of johndoematrix
Sent: Monday, January 12, 2009 4:33 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: geting info of a user who has loged in

 

am sorry for sounding naive and inexperienced, but i am stack. i have
read thru all the solutions suggested but have failed. please can
someone help with a small tutorial on how to do this. i know am asking
for too much but please help. thanks

 



[flexcoders] Re: geting info of a user who has loged in

2009-01-12 Thread valdhor
I use PHP and WebORb for PHP so anything I show will use that.
Please do not ask for a tutorial using something else.
There should be enough here for you to extrapolate for use with any
language.

This is a quick and dirty example that hard codes things. In a real
application
I would loosely couple everything with events.

My Flex project is set up with a couple of folders called components and
ValueObjects.

The main Application file (login_example.mxml):
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute xmlns:view=components.*
 applicationComplete=doApplicationComplete()
 mx:Script
 ![CDATA[
 import ValueObjects.UserCredentials;
 import components.*;
 import mx.managers.PopUpManager;
 import mx.core.IFlexDisplayObject;

 private var myLoginForm:IFlexDisplayObject;

 private function doApplicationComplete():void
 {
 myLoginForm = PopUpManager.createPopUp(this, login,
true);
 }

 public function
doLogin(userCredentials:UserCredentials):void
 {
 viewstack1.selectedChild = admin;
 admin.userCredentials = userCredentials;
 }
 ]]
 /mx:Script
 mx:ViewStack x=0 y=26 id=viewstack1 width=100%
height=100%
 view:Home id=home/
 view:Admin id=admin/
 /mx:ViewStack
/mx:Application

This has a view stack for each view - Admin and Home. There are also a
couple of functions.
doApplicationComplete is called on applicationComplete event and
instantiates the login
window. doLogin is called from the login component if login is
successful. It poulates the
userCredentials variable of the Admin component.

==
components/Home.mxml:
?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;

/mx:Canvas

This is just a container for the background of the login window at
startup.

==
components/login.mxml:
?xml version=1.0 encoding=utf-8?
mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute title=Login Form
 creationComplete=PopUpManager.centerPopUp(this)
initialize=onInitialize()
 mx:Script
 ![CDATA[
 import mx.managers.PopUpManager;
 import mx.controls.Alert;
 import mx.rpc.events.ResultEvent;
 import mx.rpc.events.FaultEvent;
 import mx.rpc.remoting.RemoteObject;
 import mx.messaging.channels.AMFChannel;
 import mx.messaging.ChannelSet;
 import ValueObjects.UserCredentials;
 import mx.core.Application;

 private var userInfoService:RemoteObject;
 private var userInfoChannelSet:ChannelSet;
 private var userInfoAmfChannel:AMFChannel;
 private var userCredentials:UserCredentials = new
UserCredentials();

 private function onInitialize():void
 {
 userInfoChannelSet = new ChannelSet();
 userInfoAmfChannel = new AMFChannel(my-amf,
http://myserver.com/WebORB/weborb.php;);
 userInfoChannelSet.addChannel(userInfoAmfChannel);
 userInfoService = new RemoteObject();
 userInfoService.channelSet = userInfoChannelSet;
 userInfoService.destination =
UserInfo.UserInfoService;
 userInfoService.requestTimeout = 30;

userInfoService.loginUser.addEventListener(ResultEvent.RESULT,
loginHandler);
 userInfoService.addEventListener(FaultEvent.FAULT,
faultHandler);
 }
 private function loginHandler(event:ResultEvent):void
 {
 if(event.result as String == Success)
 {
 Application.application.doLogin(userCredentials);
 PopUpManager.removePopUp(this);
 }
 else
 {
 Alert.show(Login Failed. Please try again);
 }
 }

 private function doLogin():void
 {
 userCredentials.username = username.text;
 userCredentials.password = password.text;
 userInfoService.loginUser(userCredentials);
 }

 private function faultHandler(fault:FaultEvent):void
 {
 switch(fault.fault.faultCode.toString())
 {
 case Client.Error.RequestTimeout:
  Alert.show(The server is not responding.
Please check that you are connected and the server is running., Server
Timeout);
break;
 default:
 Alert.show(fault.fault.faultString,
fault.fault.faultCode.toString());
  

[flexcoders] Re: geting info of a user who has loged in

2009-01-08 Thread johndoematrix
hi am using rpc(remote object). do you mind showing a simple example
on how to go abt this. one other thing, am using states so when one
logs in and its successful, the state changes and they can view thier
information like username, password, email and can edit it. thanks



[flexcoders] Re: geting info of a user who has loged in

2009-01-08 Thread johndoematrix
please guys help me out here.



[flexcoders] Re: geting info of a user who has loged in

2009-01-08 Thread valdhor
John

Please post the code you have for the login functionality. I can use
that to show you how to do the info bit.


--- In flexcoders@yahoogroups.com, johndoematrix johndoemat...@...
wrote:

 please guys help me out here.





[flexcoders] Re: geting info of a user who has loged in

2009-01-08 Thread stinasius
hi this is my the login code functionality am using that i got from
flex cookbook example and works perfect.

login.mxml
?xml version=1.0 encoding=utf-8?
mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute title=Login Form
mx:Metadata
   [Event(name=loginSuccessful, type=flash.events.Event)] 
/mx:Metadata

mx:Script
![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
import mx.events.ValidationResultEvent;

private function isValid():Boolean
{
var emailValidResult:ValidationResultEvent =
this.emailValidate.validate(this.username_txt.text);
var pswdValidResult:ValidationResultEvent =
this.pswdValidate.validate(this.password_txt.text);

if (emailValidResult.type==ValidationResultEvent.VALID 
 
pswdValidResult.type==ValidationResultEvent.VALID) 
{
return true;
}
else
{
return false;   
}

}

private function authenticateUser():void
{
if( isValid() )
{
authManager.loginUser( this.username_txt.text,
this.password_txt.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( event.result == true || event.result == TRUE ||
event.result == 1 || event.result == 1 )
{   
this.dispatchEvent( new 
Event('loginSuccessful') );
}
else
{
// login didn't work. show message
errorMessage(Login unsuccessful); 
}
}
]]
/mx:Script

mx:RemoteObject 
id=authManager 
destination=ColdFusion 
source=login_example.cfc.login 
showBusyCursor=true
   mx:method name=loginUser result=login_result(event)
fault=serverFault(event) /
/mx:RemoteObject 

mx:StringValidator 
id=emailValidate 
source={this.username_txt} 
property=text 
required=true /
mx:StringValidator 
id=pswdValidate 
source={this.password_txt} 
property=text 
required=true /

mx:Form x=0 y=0
mx:FormItem label=User Name:
mx:TextInput id=username_txt/
/mx:FormItem
mx:FormItem label=Password:
mx:TextInput id=password_txt/
/mx:FormItem
/mx:Form
mx:Text x=0 y=90 id=errorMsg visible=true color=red
width=100% height=0 /
mx:ControlBar
mx:HBox width=100%  
mx:Button label=Login id=okButton 
click=authenticateUser();/
mx:Spacer width=100%/
mx:Button label=Cancel id=cancelButton/
/mx:HBox
/mx:ControlBar
/mx:TitleWindow

mainApp.mxml

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute xmlns:view=components.*
mx:states
mx:State name=Log Out
mx:SetProperty target={label1} name=text 
value=Log Out/
/mx:State
/mx:states
mx:Script
![CDATA[
import components.*;
//Flash Classes
import flash.events.Event;
import flash.events.MouseEvent;

//Flex Classes
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;

public var loggedin:Boolean = false;
public var pop:Login;   


[flexcoders] Re: geting info of a user who has loged in

2009-01-08 Thread valdhor
For simplicity's sake, I would add a public var to your Admin
component and populate it with pop.username_txt.text:

viewstack1.selectedChild = admin;
admin.username = pop.username_txt.text;

In your Admin component's creationComplete handler, you would have
another RemoteObject call to gather user data for the user that was
passed above.

I would recommend reading some tutorials about how to use ColdFusion
and Flex (I don't use ColdFusion - I use PHP):

http://flexcf.com/tutorials
http://www.adobe.com/devnet/coldfusion/articles/data_app.html
http://www.adobe.com/devnet/flex/articles/coldfusionflex_part1.html
http://tutorial512.easycfm.com/




--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 hi this is my the login code functionality am using that i got from
 flex cookbook example and works perfect.

[snip]

 on the admin page there are three text components username, passsword
 and email address which are populated with info of the user who has
 logged in. thats where am stuck(how to populate the text components
 with the info upon successful login)





[flexcoders] Re: geting info of a user who has loged in

2009-01-06 Thread johndoematrix
yes i have implemented the login functionality and its working. nw i
am faced with the issue of showing the details of the logged in user.
any help?



Re: [flexcoders] Re: geting info of a user who has loged in

2009-01-06 Thread Haykel BEN JEMIA
If you implemented le login functionality, then you should have some
mechanism (httpservice, rpc ...) to exchange data with the server to send
login info and get a response back. Just use the same mechanisms to send a
request and get the data back.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Tue, Jan 6, 2009 at 10:44 AM, johndoematrix johndoemat...@yahoo.comwrote:

   yes i have implemented the login functionality and its working. nw i
 am faced with the issue of showing the details of the logged in user.
 any help?

  



[flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread Jason B
You'll need an httpservice to get info to and from your backend language


--- In flexcoders@yahoogroups.com, johndoematrix johndoemat...@...
wrote:

 hi guys, i have a database with user info like username, password,
 firstname, lastname, email and so on... so i created a flex login such
 that a user is prompted to login and if login is successful he/she is
 shown a page with their details from database.. how can i do that..
 the login works but i would like to pull the info of the user who
 logged in from the database and show it to them. thanks





[flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread Jason B
yes just pass the info back to the httpservice 
maybe this example will help you 
http://blog.flexexamples.com/2007/10/29/passing-parameters-to-an-httpservice/

you call the httpservice upon login button clicked
login.send();

and then the httpservice provider passes the login to your backend code


mx:HTTPService id=login url=login.php method=POST
showBusyCursor=true  requestTimeout=40
mx:request xmlns=
loginname
{name.text}
/loginname
 loginpassword
{password.text}
/loginpassword
/mx:request
/mx:HTTPService


mx:canvas etc...
mx:Label text=Name x=10 y=29/
mx:TextInput x=155 y=27 maxChars=23 id=name/

mx:Label text=Password x=10 y=66/
mx:TextInput x=155 y=66 maxChars=23 id=password/
mx:Button x=450 y=400 label=Login click=login.send();/


mx:Label text=Your login is {login.lastResult.DATARESULTS.NAME} /
/canvas etc...


login.php
?php

//checklogin then echo results

echo DATARESULTSNAMEJohn Doe/NAME/DATARESULTS;

?



--- In flexcoders@yahoogroups.com, johndoematrix johndoemat...@...
wrote:

 the example shown there using the datagrid's selecteditem to populate
 the textinputs. is there a way of populating them without the need of
 a datagrid, combobox or list based selected item? like when i sign in
 i can view my profile based on my userid and username used to signin.
 thanks





[flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread johndoematrix
any example on how to actually do this? it would be of great help. thanks



[flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread Jason B
http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html





RE: [flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread Tracy Spratt
How have you implemented your login functionality?

Tracy

 



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of johndoematrix
Sent: Monday, January 05, 2009 11:00 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: geting info of a user who has loged in

 

the example shown there using the datagrid's selecteditem to populate
the textinputs. is there a way of populating them without the need of
a datagrid, combobox or list based selected item? like when i sign in
i can view my profile based on my userid and username used to signin.
thanks

 



[flexcoders] Re: geting info of a user who has loged in

2009-01-05 Thread johndoematrix
the example shown there using the datagrid's selecteditem to populate
the textinputs. is there a way of populating them without the need of
a datagrid, combobox or list based selected item? like when i sign in
i can view my profile based on my userid and username used to signin.
thanks