6 Replies Latest reply on Sep 26, 2008 10:51 AM by Ansury

    Make A Canvas Look Like A Button?

    Holomew Level 1
      I have some canvases (canvasi?) that I want to make look like buttons with rounded corners and bevels, maybe a drop shadow, but I know this can't be done to a canvas.

      Ideally, I like the way panels look but I don't want the white space in the middle of it.

      I also like buttons but I'm not sure if I can use a button like a layout component.

      The item needs to have room for some text (a label), a graphic, and it also needs to work like a button (meaning it can be clicked and can navigate and store some information).

      Any ideas?
        • 1. Re: Make A Canvas Look Like A Button?
          Level 7

          "Holomew" <webforumsuser@macromedia.com> wrote in message
          news:gbgrc4$rho$1@forums.macromedia.com...
          >I have some canvases (canvasi?) that I want to make look like buttons with
          > rounded corners and bevels, maybe a drop shadow, but I know this can't be
          > done
          > to a canvas.
          >
          > Ideally, I like the way panels look but I don't want the white space in
          > the
          > middle of it.
          >
          > I also like buttons but I'm not sure if I can use a button like a layout
          > component.
          >
          > The item needs to have room for some text (a label), a graphic, and it
          > also
          > needs to work like a button (meaning it can be clicked and can navigate
          > and
          > store some information).
          >
          > Any ideas?

          Canvas _does_ have a cornerRoundness style and a filters property.

          HTH;

          Amy


          • 2. Re: Make A Canvas Look Like A Button?
            Holomew Level 1
            There's a cornerRadius but it doesn't show rounded corners like the panels do. I'm not sure what else to use.
            • 3. Make A Canvas Look Like A Button?
              Ansury Level 3
              Don't have Flex 3 here to test (just 2) but on 2...

              cornerRadius only works if you set borderStyle to "solid".

              Optionally:
              dropShadowColor="#000000" dropShadowEnabled="true"

              Gets it pretty close... I suspect that trying to get Canvas to do anything it's not "supposed" to do is going to be more trouble than it's worth, and Canvas really seems to be your best bet unless you're willing to just use Panel.

              Also I've never used it but I think there's a borderSkin prop you can set as well, if you're really picky.
              • 4. Re: Make A Canvas Look Like A Button?
                Level 7

                "Ansury" <webforumsuser@macromedia.com> wrote in message
                news:gbj1rt$lar$1@forums.macromedia.com...
                > cornerRadius only works if you set borderStyle to "solid".
                >
                > Optionally:
                > dropShadowColor="#000000" dropShadowEnabled="true"
                >
                > Gets it pretty close... I suspect that trying to get Canvas to do anything
                > it's not "supposed" to do is going to be more trouble than it's worth, and
                > Canvas really seems to be your best bet unless you're willing to just use
                > Panel.

                Oh, thanks for that :-). I had some Canvas itemRenderers that I couldn't
                get to show a rounded corner no matter what I did. Added a 0 width solid
                border et voila! I had no idea the two properties were connected.



                • 5. Re: Make A Canvas Look Like A Button?
                  Holomew Level 1
                  That's great, thanks!

                  What's more is you can also apply shadowDirection and shadowDistance. I'm not sure why Adobe doesn't standardize these effects for different objects.

                  I also really wish there was a bevel option.

                  Just out of curiosity, wouldn't I be able to use a button as a panel if I wanted to? I could still place labels, images, VBox, HBox, inside of a button, no?
                  • 6. Re: Make A Canvas Look Like A Button?
                    Ansury Level 3
                    Cool, no prob. As for using a button I wouldn't try it even if it worked, due to the "it's not designed for that" principle. Plus you'd probably still get that "click" effecting the whole "button/canvas" when any component was clicked... click events fired.. who knows.