Flex/Flash/Actionscript

New Component: CanvasButton added to FlexLib

I just made a quick new component and added it to FlexLib. It’s a Button component, but it allows you to add any child UI components to the button via MXML. So if you find the single icon and label format of the button to be a bit too restrictive, you can use this component to layout your button however you want. This is in response to a recent question asked on flexcoders.

So for example, in the sample below the top button is created like this:




	

		

		

			

				

			

		

		

	



View the source
View the documentation

Note: this has been added to the SVN repository for FlexLib but is not yet in the distribution zip. The distribution zip will get updated once we have a bigger changeset (oh, and it’s coming…)

This movie requires Flash Player 9.

Standard

13 thoughts on “New Component: CanvasButton added to FlexLib

  1. Hi Doug, thanks again for this nice and useful component (I’ve already left some comments on Flexcoders).

    Borek

  2. Hi Doug, I played around with your component and it unfortunately brakes the design view. I am quite happy to live in the MXML world but this can be an issue for designers (and to be honest, sometimes it’s quite convenient to be able to edit things in WYSIWYG mode).

    But thanks for your component anyway.
    Borek

  3. Swede says:

    Hi Doug, thanks for the component. I’m having a problem when trying to use an extension of CanvasButton as a headerRenderer for an Accordion. I get the following exception at runtime:

    ReferenceError: Error #1065: Variable http://www.adobe.com/2006/flex/mx/internal::setDocumentDescriptor is not defined.

    Am I doing something silly, or missing something?

    Thanks!

  4. Hi Doug, I am trying to use the component in Flex 3 and it doesn’t appear to like it, either in the IDE design view, via MXML, or if I instantiate programmatically within ActionsScript. Does this component work in Flex 3, or maybe no?

    I was hoping to use it as a delegate headerRenderer for an Accordion header and I noticed that someone else on this post had the same issues, but their link is dead. Is there any info you could give me?

    Can’t wait to see if this will work for me. The component looks great!

  5. Mike says:

    Thanks for this. Can you use the CanvasButton class to have the label text on a button wrap? If so, chow can you create a Custom Button class that extends the CanvasButton class and make sthe label text wrap?
    thanks!

    -Mike

  6. Pingback: ??????? » Blog Archive » ?????Flex??

  7. Pingback: Flex??

  8. Pingback: Flex?? « Sealyu's Blog

  9. Pingback: Flex????(?) | ?????

Comments are closed.