Thnaks for the help, here is the problem that I am getting.  I will
show you my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" >
        <mx:Script>
                <![CDATA[
                        public var obj:Object = new Object;
                        public function DoIt():void
                        {
                                NewObj();
                        }
                        public function NewObj():void
                        {
                                obj.myInput1 = 'Odd';
                                obj.myInput2 = 'Even';
                                obj.myInput3 = 'Odd';
                                obj.myInput4 = 'Even';
                                obj.myInput5 = 'Odd';
                                obj.myInput6 = 'Even';
                                obj.myInput7 = 'Odd';
                                
                                for (var prop:String in obj)
                                {
                                        if(this[prop].text) {
                                                trace('found');
                                                this[prop].text = obj[prop];
                                        }
                                }
                        }
                ]]>
        </mx:Script>
        <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"/>
        <mx:Button id="Click" click="DoIt()"/>
</mx:Application>

I get an error "ReferenceError: Error #1069: Property myInput6 not
found on Objects and there is no default value."  Not sure whey
myInput6 is being seen since I am doing the if statement.

Any ideas?

Thanks for the help
timgerr 


--- In flexcoders@yahoogroups.com, 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
>


Reply via email to