0 Replies Latest reply on Feb 11, 2012 7:37 AM by wu0773

    How does one define a default style for a custom Flex component?

    wu0773

      How does one define a default style for a custom Flex component?

       

      hello

       

      I created a new set of Flex component library slib.swc (Flex 4.5). Would also like to have a default style. defaults.css file, making it the default style of the component library.

       

      Like flex the builder install directory of sdks \ 4.5.0 \ frameworks out \ libs directory has a spark.swc file, open with Winrar will see defaults.css this file. Defaults.css file defines the default style of the flex spark components.

       

      How can it be achieved?

       

       

       

      As follows

       

       

      slib.swc contains a CLabelEx components, and a defaults.css file

       

      defaults.css source file as follows:

       

      @ namespace s "library :/ / ns.adobe.com / flex / spark";

      @ namespace mx "library :/ / ns.adobe.com / flex / mx";

      @ namespace cn "http://os.slib.cn";

       

      cn | CLabelEx

      {

              styBackgroundAlpha: 1;

              styBackgroundColor: # 569CC0;

              styBorderAlpha: 1;

              styBorderColor: # 569CC0;

              styBorderWeight: 1;

              styCornerRadius: 3;

      }

       

      In slib.swc the application MyLabel.mxml of the source file as follows:

      <? xml version = "1.0" encoding = "utf-8"?>

      <s: Application, the xmlns: fx = "http://ns.adobe.com/mxml/2009

                                 xmlns: s = "library :/ / ns.adobe.com / flex / spark"

                                 xmlns: mx = "library :/ / ns.adobe.com / flex / mx"

                                 xmlns: cn = "http://os.slib.cn

                                 the minWidth = "955" The minHeight = "600">

              <fxeclarations>

              </ fxeclarations>

              <cn:CLabelEx x="67" y="112"/>

      </ s: Application>

       

      I hope CLabelEx default use cn | CLabelEx, style to display its appearance.

      I refer to above approach, but failed to achieve. Can you please re-Detailed

       

      Thanks!