We're not an interpreted language and don't have eval().  The best you
can probably do is something like:

 

this[_stackName].selectedChild = this[_stateName]

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of timgerr
Sent: Tuesday, April 15, 2008 8:16 PM
To: [email protected]
Subject: [flexcoders] Pass Variables and then run a command

 

Hey all, I am new with flex, coming from JavaScript and perl. 
I am writing an application that will have lots of MXML components
like a login component, register component and many more. The problem
is I am trying to have all the components talk to each other, I am
having trouble doing that. This is my problem, I have a viewStack and
I created a method like this

private var _stackName:String;
private var _stateName:String;
private var _runStackChild:String;

public function ChangeState(stackName:String, stateName:String)void
{
_stackName = stackName;
_stateName = stateName;
_runStackChild = _stackName + ".selectedChild = " + _stateName ;
_runStackChild;
}

<mx:Button id="btnOne" click="ChangeState('vsTop','register');

So when I click the button the mothod ChangeState is called and passed
are the 2 variables. At the end ChangeState should run the command 
vsTop.selectedChild = register;

If I clear the method and just add vsTop.selectedChild = register;,
the stack is changed, but when I run _runStackChild; nothing hapends. 

What am I missing???

Thanks,
Timgerr

 

Reply via email to