myTabNav.creationPolicy = "all";

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of timgerr
Sent: Monday, May 19, 2008 12:00 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Write Data to Tab Navigater


Hello, I have a question for ya, I have this tab navigator and I have a
few text input boxes in each one.  I create a json call and I want to
populate the text input boxes with the requested data.  

<mx:TabNavigator xmlns:mx="http://www.adobe.com/2006/mxml"; width="400"
height="500">
        <mx:Canvas label="User" width="100%" height="100%" id="UserTab">
                <mx:Form width="100%" height="467">
                        <mx:FormItem label="First Name"
id="firstNamelbl">
                                <mx:TextInput id="firstName"/>
                        </mx:FormItem>
                        <mx:FormItem id="lastNamelbl" label="Last Name">
                                <mx:TextInput id="lastName"/>
                        </mx:FormItem>
                        <mx:FormItem id="emaillbl" label="Email" >
                                <mx:TextInput id="email"
editable="false"/>
                        </mx:FormItem>          
                </mx:Form>
        </mx:Canvas>

        <mx:Canvas label="Company" width="100%" height="100%"
id="CompanyTab">
                <mx:Form width="100%" height="100%">
                        <mx:FormItem id="companynamelbl" label="Company
Name">
                                <mx:TextInput id="companyname"/>
                        </mx:FormItem>
                        <mx:FormItem id="addressonelbl"  label="Address
One">
                                <mx:TextInput id="addressone"/>
                        </mx:FormItem>
                        <mx:FormItem id="addresstwolbl" label="Address
Two">
                                <mx:TextInput id="addresstwo"/>
                        </mx:FormItem>
                        <mx:FormItem id="statelbl" label="State">
                                <mx:ComboBox id="state">
                                        
                                </mx:ComboBox>
                        </mx:FormItem>
                        <mx:FormItem id="ziplbl" label="Zip Code">
                                <mx:TextInput id="zip"/>
                        </mx:FormItem>
                        <mx:FormItem id="countrylbl" label="Country">
                                <mx:ComboBox id="country">
                                </mx:ComboBox>
                        </mx:FormItem>
                </mx:Form>
        </mx:Canvas>
</mx:TabNavigator>

So I have these 2 tabs a user and company tab.  When I return the JSON I
have an object so I create a function 
public var DoThis(obj:Object)
{
 firstName.text = obj.firstName;
 lastName.text = obj.lastName;
 email.text    = obj.email;
 addressone.text = obj.addressone;
 addresstwo.text = obj.addresstwo;
 state.text = obj.state;
 country.text = obj.country
}

So I call that function to populate the text inputs in the tabs but I
get an error, "TypeError: Error #1009: Cannot access a property or
method of a null object reference."

Since 
 firstName.text = obj.firstName;
 lastName.text = obj.lastName;
 email.text    = obj.email;
are shown on the first tab when the function is called, they work, but
the other items  addressone.text = obj.addressone;  addresstwo.text =
obj.addresstwo;  state.text = obj.state;  country.text = obj.country
give me the error , if I comment them out they work fine.  

I am used to DoJo when creating a Tab Navigator I can write to all the
text input win the other tabs that are not shown.  Can I write to
something a tab if it is now displayed yet in flex???

Thanks for the help,
timgerr


------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links



Reply via email to