Alright, sorry, as this is my first post and I'm relatively new to actionscript, this may seem like a dumb post.
I'll try to describe a bit of what I'm trying to do and afterwards post the code.
I'm making a simple register/login mxml. I'm able to do both of those with php. I have my own local db. The problem is, after I log in I want to grab all the information from the db.
For this I created a class, MemberProfile. As of now, it only grabs two things: username and email. I use the URLrequest, variables, and loader to send the request along with the logged in members userId. The odd thing is that once it goes to my onComplete function, I can see the two variables (I use alert boxes, I know they're sent back); however, when I store them into the class vars and then attempt to view them back in the main mxml file, it only shows as null.
my call to the class
The email and username alert box show null while the userid shows the correct id.
private function buildProfile( loggedUserId:int ):void
userProfile = new MemberProfile( loggedUserId );
Alert.show( "Email " + userProfile.email );
Alert.show( "Username " + userProfile.username );
Alert.show( "UserId " + userProfile.userId );
In this alert, username and email is my getter functions and they display the correct information.
public function MemberProfile( userId:int )
this._userId = userId;
var request:URLRequest = new URLRequest ("http://localhost/php_code/profile.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.userId = userId;
request.data = variables;
var loader:URLLoader = new URLLoader ();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
private function onComplete ( event:Event ):void
var variables:URLVariables = new URLVariables( event.target.data );
var temp:String = variables.username;
this._username = temp;
temp = variables.email;
this._email = temp;
Alert.show( "Setting username and email: " + username + " " + email );
Any idea how to keep the data?