Adobe Flex 4 * Creating deferred components

When you set a container’s creationPolicy property to none, components declared as MXML tags inside that container are not created.

For Spark containers, you use the createDeferredContent() method to manually instantiate deferred components. This method is defined on the spark.components.SkinnableContainer class.

For MX containers, you use the createComponentsFromDescriptors() method to manually instantiate deferred components. This method is defined on the MX Container base class.

Advertisements

Spark vs Halo Themes

The Spark theme is the default theme for Flex 4. Halo theme was the default theme for Flex 3. Each of these themes will support different styles. So, it is up to you which theme you want to use depending on the look and feel that you are going for in your application. There is no equivalent for the Halo theme’s borderThickness in the Spark theme. In general, the Halo theme has a lot more ‘out-of-the-box’ styles for components and containers. However, using custom skins is much easier if your application uses the Spark theme.

If you look at the ASDocs for each of the component classes, the styles should have a “theme” listed where it tells you whether that style is supported on Halo, Spark or both. The other theme that comes with the Flex 4 SDK is the Wireframe theme which doesn’t support any styles.

If you want to use the Spark theme, you can consider changing your Canvas component to a Spark BorderContainer which contains the borderWeight style that will do what you want.

Spark and Halo Themes both together

Flex 4 by default comes with spark theme

but if you want to use halo theme along with spark theme

  1. In Flash Builder 4.x, select Project > Properties from the main menu.
  2. Select Flex Compiler from the left menu.
  3. In the Additional compiler arguments text field, add the following argument:

-theme+=${flexlib}/themes/Halo/halo.swc

“+=” is very important as you need to have both spark and halo