4 Replies Latest reply on Mar 17, 2009 12:37 PM by alice_data

    How to Add/Change Color to UI Components

    alice_data Level 1
      Hi,
      I wonder if this is possible and that if someone might be able to guide me to start on this. I am hoping to create some pre-designed shapes for users to drag and drop, and to be able to change colors of the shape they drag.

      I am not sure if we can do this with the dynamic programmatically drawn UI components, I tried to do that with the color picker, but I think it only goes with mx.containers.

      Is it possible to achieve what I tried to do here?
      I welcome any suggestion on this.

      Alice
        • 1. Re: How to Add/Change Color to UI Components
          Gregory Lafrance Level 6
          Are you saying you might create some components for shapes like in, for example, a flowchart application, and user can change the color of the shapes?

          You could implement custom style properties for your components.

          This FB3 help sys doc may help:

          Example: Creating style properties
          • 2. Re: How to Add/Change Color to UI Components
            alice_data Level 1
            Hi, Greg:

            For your question on flowcharts, yes, I am trying to create something that would allow another person build a customized flow chart online from scratch, and I think Flex may be the option.
            The article you provided here, I think I did come across the article at some time, but I was hoping to see if we could alter it after it was pre-set to something.

            In other words, if a person creates a 3*5 rectangle that is preset to red, I was hoping that he could use a color picker and change it to blue.

            Thanks for your help.

            Alice

            • 3. Re: How to Add/Change Color to UI Components
              Gregory Lafrance Level 6
              If you add custom style properties, you could include a color picker in your app that would allow the user to change the color. It might even be possible to create custom components based on something like Canvas, with the shape being drawn in the updateDisplayList method.

              See this FB3 help sys doc. It creates a rectangle with only two of its corners rounded:

              Drawing programmatically
              • 4. Re: How to Add/Change Color to UI Components
                alice_data Level 1
                Hi,

                Thanks for providing me with that link, and I tried to create a programmatic drawing and tried to change its color, but it looks like I am not sure how to convert the hex value of the color from the color picker to its alpha value.

                I am not sure this is the only error I have here. I tried to change the color of the "programmed" drawing, which I did successfully changed the color of the HBox according to the document.

                Thanks again for your help.

                Alice