5 Replies Latest reply on Nov 6, 2009 9:19 AM by thenewmexican62

    Question about accessing fields contained in a tab from AS3

    thenewmexican62

      My hierarchy looks like this:

       

        I have a

         <mx:Panel>

          <mx:Button label="Add User" click="addUser(event)" />

          <mx:Tab

        </mx:Panel>

        • 1. Re: Question about accessing fields contained in a tab from AS3
          thenewmexican62 Level 1

          Sorry. Pressed the save button by accident

           

          I have a

             <mx:Panel>

                <mx:Script>
                          <![CDATA[

                                             private function addUser(event:Event): void {

                                                     var userID:String = userIDTF.text; //: Causes an exception

           

                                                 //: The problem I'm having is. If I'm on the first tab, which is the "Other Maint." Tab.

                                                //: accessing userIDT, which is in the "addNewUserTab", causes an exception to be thrown by the runtime.

                                                //: since I'm developing under linux. I can't see the exception.

                                                //: My question is. How do I access fields defined in other tabs from

                                               //: My AS function, if the tab in question is not visible.

           

                                             }
                          ]]>
              
               </mx:Script>

              <mx:Button label="Add User" click="addUser(event)" />

              <mx:TabNavigator>

               <!-- three tabs defined -->

                 <mx:Canvas label="Other Maint." id="otherMaintArea" width="300" height="300">

           

               </mx:Canvas>

               <mx:Canvas label="Do User Saerch" id="searchForUserArea" width="300" height="300">

           

               </mx:Canvas>

              <mx:Canvas label="Add New User" id="addNewUserArea" width="300" height="300">

                    <mx:Hbox>

                      <mx:Label text="User ID"/>

                      <mx:TextInput id="userIDTF"/>

                    </mx:HBox>

              </mx:Canvas>

           

             </mx:TabNavigator>

           

            </mx:Panel>

           

           

           

            The problem I'm having is. If I'm on the first tab, which is the "Other Maint." Tab.

            accessing userIDT, which is in the "addNewUserTab", causes an exception to be thrown by the runtime.

             since I'm developing under linux. I can't see the exception.

             My question is. How do I access fields defined in other tabs from

             My AS function, if the tab in question is not visible.

           

           

          Thanks in advance.

          • 2. Re: Question about accessing fields contained in a tab from AS3
            Flex harUI Adobe Employee

            In a model/view or MVC architecture, your views would not talk to each other.  They would modify the model and the other view would reflect those changes.

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui

            • 3. Re: Question about accessing fields contained in a tab from AS3
              thenewmexican62 Level 1

              Sorry. But. You don't understand the use case here. I understand all about the MVC design and implementation pattern.

              This case, is all about gathering a large number of  inputs, spread out across various tabs, then, using that input to create an object on the server.

              This is NADA todo with another view displaying anything.

              • 4. Re: Question about accessing fields contained in a tab from AS3
                rgadiparthi

                set creationpolicy="all" on your tabnavigator.

                 

                Regards,

                Ranga G

                • 5. Re: Question about accessing fields contained in a tab from AS3
                  thenewmexican62 Level 1

                  Thanks for the info. It worked. But. More than that. After reading about creationPolicy property. Has given me a much better understanding

                  of the of how objects are created and managed in Flex.

                   

                  Thanks again.