views:

25

answers:

1

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!

+2  A: 

Change the following code:

function getProfileinfo(pointer:String):void{
            trace(myProfile[pointer]);
        }

Plus, you should put this code into a Class.

Todd Moses