You want

this[prop].text

to get to the TextInputs.

Also, to see if there is a field "foo" on object "bar" use:

if ("foo" in bar)
{
   //...
}

-Josh

On Tue, Nov 4, 2008 at 9:55 AM, Alex Harui <[EMAIL PROTECTED]> wrote:

>  if(this[prop].text) {
> trace('found');
> this[prop].text = obj[prop];
>
>   *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *timgerr
> *Sent:* Monday, November 03, 2008 11:36 AM
> *To:* flexcoders@yahoogroups.com
> *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
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk

Reply via email to