7 Replies Latest reply on Apr 12, 2008 5:10 PM by user341975

    if Conditions and URL

    user341975
      I am new to Flex. I have been asked to change an existing app. I need to display few url's to user based on their role. Based on the role i should enable or disable the url's. Please let me know how i can do this.
        • 1. Re: if Conditions and URL
          ntsiii Level 3
          Not understanding.

          "url" is a "universal resource locator" string. What would disabling a string do?

          Or do you mean you want to display some controls that, when clicked, cause a site to open in a browser? And you want to disable some of those controls?

          Tracy
          • 2. Re: if Conditions and URL
            user341975 Level 1
            Yes you are correct. I mean href tag.

            "Or do you mean you want to display some controls that, when clicked, cause a site to open in a browser? And you want to disable some of those controls?"
            • 3. Re: if Conditions and URL
              ntsiii Level 3
              The short answer is use LinkButton. It can be enabled/disabled programatically.

              We will need more details if you want more specific help.

              Tracy
              • 4. Re: if Conditions and URL
                user341975 Level 1
                Here is my requirement

                I am modifing an existing application and i new to flex.

                I have the class file. The code is as follows

                Package tdo
                {
                [remoteclass {alias="cname"}]

                [bindable]

                public class cname {
                public var logedin:bulean = false;
                public var id:string = "";
                Public var username:string = "";
                Public var rolename:string = "";

                public function cname()
                {
                }
                }

                }


                I have main .mxml file that is validating user login and it has reference to "cname". I could show the user who has loged in using alerts.

                I have another page where i need to enable or disable the link buttons based on who loged in. I am unable to reference the "username from cname".

                Please let me know how i can achieve this.
                • 5. Re: if Conditions and URL
                  ntsiii Level 3
                  You can access a public instance of cname from a sub component using mx.core.application.application.cnameInstanceId

                  Tracy
                  • 6. Re: if Conditions and URL
                    user341975 Level 1
                    I will try this and will update you.

                    Are there any samples to explain the same?

                    I just want to understand the flex architecture and want to be able to start modifying the code without messing up the existing code. Please let me know of any documents’ or books or samples that I can refer to get a quick start.

                    Thank you,
                    • 7. Re: if Conditions and URL
                      user341975 Level 1
                      I tried as specified " mx.core.application.application.cnameInstanceId.role_name". I can get the value i need on the page but i ran into one more issue. Here is the problem

                      I have main mxml page which has a "custom component".

                      I was using " mx.core.application.application.cnameInstanceId.role_name" to identify users role at "initapp" functions of the .mxml for the "custom component" Based on users role i was hiding a panel.

                      The code works fine but when i try to login as multiple users with differnet roles, i have issue. I click on log out button, which takes me to the main login page where i login in as a differnet user, the initapp funcition of the custom component is not executing. If i refresh the browser before loging as new user, the code works fine. Is there any function or any piece of code that i can use in the log out function to refresh the page so i can make the initapp function to execute?