5 Replies Latest reply on Sep 23, 2008 8:17 AM by fccobb

    Style Inheritance

      Hi

      I'm tring to set up some styles for my components in Flex and I was wondering if someone could help me with this.

      I've attached my code so you can have a look and its a very simple example to illustrate the point. In the example I want to set the application background color to blue and the panel border to red.

      But the Panel Border seems to inherit its background color from the application and therefore sets the Panel Border to purple instead of red.

      Can someone give me some advice on how to stop this happening - I thought if you set a style inline it overode the parent style but it doesn't seem to.

      Thanks

      Chris
        • 1. Re: Style Inheritance
          istrasci
          A problem similar to mine... Make sure the Alphas are all off (no transparency) because that plays into the final colour calculation...
          • 2. Re: Style Inheritance
            Level 7
            "fccobb" <webforumsuser@macromedia.com> wrote in message
            news:gban5n$6km$1@forums.macromedia.com...
            > Hi
            >
            > I'm tring to set up some styles for my components in Flex and I was
            > wondering
            > if someone could help me with this.
            >
            > I've attached my code so you can have a look and its a very simple example
            > to
            > illustrate the point. In the example I want to set the application
            > background
            > color to blue and the panel border to red.
            >
            > But the Panel Border seems to inherit its background color from the
            > application and therefore sets the Panel Border to purple instead of red.
            >
            > Can someone give me some advice on how to stop this happening - I thought
            > if
            > you set a style inline it overode the parent style but it doesn't seem to.
            >
            > Thanks
            >
            > Chris
            >
            > <?xml version="1.0" encoding="utf-8"?>
            > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
            > layout="absolute"
            > backgroundColor="0x0000FF">
            > <mx:Panel x="295" y="79" width="250" height="200" layout="absolute"
            > borderColor="0xFF0000">
            > </mx:Panel>
            > </mx:Application>

            Just a wild guess, but have you tried #FF0000?


            • 3. Re: Style Inheritance
              Level 1
              Hi istrasci

              Thanks for the reply.

              Have you posted about something similar then because if so I've missed it ?

              I've got no settings for Alphas so hopefully thats not effecting things.

              Chris
              • 4. Re: Style Inheritance
                Level 1
                Hi Amy

                Thanks for the suggestion - I'm afraid it doesn't make any difference though.

                Got me really confused this one as its so simple what I am trying to do.

                Thanks again

                Chris
                • 5. Re: Style Inheritance
                  Level 1
                  Hi istrasci again

                  I beg your pardon - if I set the borderaplha explcitly to 1 on the panel rather than not setting it all then the color setting for the border works as planned.

                  So I suppose its inheriting an default alpha from the application of 0.5 or similar which means the colors mix.

                  Thanks very much - I'm not abolutely sure thats what you meant but it certainly fixes it for me !

                  Thanks again

                  Chris