Creating custom design-time preview for Flex 3 components

Sometimes it is necessary to create custom preview of the component in the Flex Builder “Design” view.
It is undocumented feature ;-)
I’ve found very interesting class in the Flex SDK 3: mx.core.UIComponentGlobals.

This class contains static field designMode:Boolean.

Just check that field in your component code.
You can download example component with the source code from here:
http://anychart.com/tips_and_tricks/designMode/DesignModeComponent.zip

Also you can download the usage sample:
http://anychart.com/tips_and_tricks/designMode/DesignModeComponentSample.zip

Running in the Flex Builder “Design” mode it shows AnyChart image. But when it runs in the flash player it shows only gray rectangle.

3 Responses to “Creating custom design-time preview for Flex 3 components”

  1. ivan Says:

    hello. do i need to compile component to swc to get a result or no?

  2. Alex Batsuev Says:

    Yes.

  3. GallantGifts Says:

    I just found your post and am going to share it with my developer.
    Thanks…

Leave a Reply