9 Replies Latest reply on Feb 26, 2009 3:06 PM by injpix

    Components

    SmilingRoses
      I have a login button that when pressed if login was a success a tab on the tabnavigator becomes visible. My problem is this. If the tab that I want to become visible is part of the main application then it work fine and becomes visible, but if the tab is a component then it will not become visible until after a refresh of the browser. I'm sure there must be a simple solution to this, but I just don't know it.

      Can anyone help with this?

      As long as I'm asking a question there is another little problem. The tab itself is not invisible only the content of the tab page. I would like the tab to be invisible also until the proper login has happened.
        • 1. Re: Components
          Francisc Level 3
          Hmmm... I don't get it. What is a component? The content of the Tab?

          Can you post a bit of the code please?
          • 2. Re: Components
            Level 7

            "SmilingRoses" <webforumsuser@macromedia.com> wrote in message
            news:go4jmp$8n2$1@forums.macromedia.com...
            >I have a login button that when pressed if login was a success a tab on
            >the
            > tabnavigator becomes visible. My problem is this. If the tab that I want
            > to
            > become visible is part of the main application then it work fine and
            > becomes
            > visible, but if the tab is a component then it will not become visible
            > until
            > after a refresh of the browser. I'm sure there must be a simple solution
            > to
            > this, but I just don't know it.
            >
            > Can anyone help with this?
            >
            > As long as I'm asking a question there is another little problem. The tab
            > itself is not invisible only the content of the tab page. I would like the
            > tab
            > to be invisible also until the proper login has happened.

            Code?


            • 3. Re: Components
              SmilingRoses Level 1
              Was I posting to a flex 3 forum? Any flex developer should know what a component is and how it is different from the main application.

              I have been thinking about the problem I posted. I created a custom Event on the Login (component) and handled it in the main application with a call to a function that told the tabs in question to become visible. The tab with content that was already a part of the main application became visible and all data on that page was accessible, but the tab with an instantiation of a component became visible, but the data that was suppose to be available in the form and in the datagrid was not available (until a refresh to the browser was performed). I think I am missing a step. I need to communicate to the component that a call to the database is necessary to populate the form and datagrid.

              The tabs I am talking about are part of the TabNavigator Container, and the content is what is on the tabs page. The code is way too complicated to post. I think that if I think this out logically I will be able to figure it out, but if there is someone out there who has had this problem and has already figured it out I would appreciate the help.
              • 4. Re: Components
                Level 7

                "SmilingRoses" <webforumsuser@macromedia.com> wrote in message
                news:go5be0$5p6$1@forums.macromedia.com...
                > Was I posting to a flex 3 forum? Any flex developer should know what a
                > component is and how it is different from the main application.
                >
                > I have been thinking about the problem I posted. I created a custom Event
                > on
                > the Login (component) and handled it in the main application with a call
                > to a
                > function that told the tabs in question to become visible. The tab with
                > content
                > that was already a part of the main application became visible and all
                > data on
                > that page was accessible, but the tab with an instantiation of a component
                > became visible, but the data that was suppose to be available in the form
                > and
                > in the datagrid was not available (until a refresh to the browser was
                > performed). I think I am missing a step. I need to communicate to the
                > component
                > that a call to the database is necessary to populate the form and
                > datagrid.
                >
                > The tabs I am talking about are part of the TabNavigator Container, and
                > the
                > content is what is on the tabs page. The code is way too complicated to
                > post. I
                > think that if I think this out logically I will be able to figure it out,
                > but
                > if there is someone out there who has had this problem and has already
                > figured
                > it out I would appreciate the help.
                >

                Are you posting to a Flex forum? Any developer should know how to make sure
                that their data is ready before they try to access it.


                • 5. Re: Components
                  SmilingRoses Level 1
                  The data is there if I do a refresh. I am trying to show the data without having to refresh the browser. Like I said, the form and datagrid that reside on the main application shows the data with no refresh, but the form and datagrid on the component don't show their data without a refresh.

                  I didn't mean to insult anyone. I was just surprised at the question.

                  I would still appreciate any help that anyone can give me.
                  • 6. Re: Components
                    Level 7

                    "SmilingRoses" <webforumsuser@macromedia.com> wrote in message
                    news:go69v3$cjt$1@forums.macromedia.com...
                    > The data is there if I do a refresh. I am trying to show the data without
                    > having to refresh the browser. Like I said, the form and datagrid that
                    > reside
                    > on the main application shows the data with no refresh, but the form and
                    > datagrid on the component don't show their data without a refresh.
                    >
                    > I didn't mean to insult anyone. I was just surprised at the question.
                    >
                    > I would still appreciate any help that anyone can give me.

                    Since I have never had the issue you're experiencing, I can only assume that
                    there is something different in how you're coding things vs. how I would
                    have coded it.

                    If you boil your problem down to some simple example code, we can probably
                    see where the problem lies. But often people find that in the process of
                    boiling it down to a simple example, they can see it themselves.


                    • 7. Re: Components
                      Gregory Lafrance Level 6
                      When I solve tough problems, it is usually because I have boiled the problem down to simplified code and isolated the problem. When I post a question here (which I rarely do, most of my posts are helping out others), I try to post minimal code samples, or better yet code that is complete and yet still enhibits the issue.

                      Amy doesn't list her post count, but she's in here daily as one of the most active contributors.

                      I'm not trying to berate, but only to encourage to help those of us who are committed to Flex and to helping everyone out, by posting simplified yet complete code and sample data. You will be surprised how quickly great solutions arise.
                      • 8. Re: Components
                        injpix Level 3
                        The term 'Components' in the context of “components vs main application” may be obvious to some, but in the context of Flex applications it is pretty vague. In the latter context, the term components may refer to an UI, ActionScript or MXML component.

                        Anyways, I believe I haven't ever had the issue you are having. Without seeing any code and taking a shot-in-the-dark, I would assume that it has to do with the component's life cycle. Specifically when its instantiated.

                        “If you boil your problem down to some simple example code, we can probably
                        see where the problem lies.”

                        That's like applying Occam's razor principle! :)
                        • 9. Re: Components
                          injpix Level 3
                          Also, have you tried setting creationPolicy for the TabNavigator to 'ContainerCreationPolicy.ALL'? Is if that eliminates the problem. This test may help reveal your problem. If your application is simple, this may be a solution. But if its complex, you may need to continue using 'deferred instantiation'.