Reputation: 159
So I need to return the location or fname or what ever.... I would like to do this just by changing the pointer variable. I'm just comming from php to flex so I don't know what I'm doing -=) How can I do this?
public var myProfile:Object={
fname:"Deyon",
lname:"Smith",
age:"31",
loc:"New York"};
public var pointer:String="loc";
public function getProfileinfo():void{
trace(myProfile.pointer);
}
Thank you!
Upvotes: 2
Views: 94
Reputation: 11029
Change the following code:
function getProfileinfo(pointer:String):void{
trace(myProfile[pointer]);
}
Plus, you should put this code into a Class.
Upvotes: 2