Deyon
Deyon

Reputation: 159

Trying to learn Flex function, vars and data flow

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

Answers (1)

Todd Moses
Todd Moses

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

Related Questions