if(this[prop].text) {
trace('found');
this[prop].text = obj[prop];

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of timgerr
Sent: Monday, November 03, 2008 11:36 AM
To: [email protected]
Subject: [flexcoders] How to test for object and do other things


Hello all,
I have a question for ya, have an object and I want to test for a flex
ui component with that name. Here is what I am trying to do.

I have these flex UI items:
<mx:TextInput id="myInput1" text="Enter text here"/>
<mx:TextInput id="myInput3" text="Enter text here"/>
<mx:TextInput id="myInput5" text="Enter text here"/>
<mx:TextInput id="myInput7" text="Enter text here"/>

I have an object:
obj.myInput1 = 'Odd';
obj.myInput2 = 'Even';
obj.myInput3 = 'Odd';
obj.myInput4 = 'Even';
obj.myInput5 = 'Odd';
obj.myInput6 = 'Even';
obj.myInput7 = 'Odd';

so I can do this to see what is in the object:
for (var prop:String in obj)
{
trace(prop, ' is ' + obj[prop]);
}

and I will get:
myInput1 is Odd
myInput2 is Even
myInput3 is Odd
myInput4 is Even
myInput5 is Odd
myInput6 is Even
myInput7 is Odd

Now I want to test to see if we have the textinput items for each
return of obj

I want to do something like this:
for (var prop:String in obj)
{
trace(prop, ' is ' + obj[prop]);
if(prop.text) {
trace('found');
prop.text = obj[prop];
}
This should find
myInput1
myInput3
myInput5
myInput7

and add the information in the object to the textinput items.

but the problem is that the above code dosnt work, how can I do this?
Thanks for the help,
timgerr

Reply via email to