Skinning Flex containers using WSDoubleBorderSkin

WSDoubleBorderSkin is a programmatic skin extending mx.skins.Border for adding double borders on Flex containers such as Canvas, HBox, VBox, Form etc. It supports properties for different border positions such as borderTop or borderBottom, colors and thicknesses using CSS. It’s designed for using Flex states based on mx.states.Transition. The WSDoubleBorderSkin is tested under Flex 2 and 3 (Moxie).

Screen shot

Instructions

Code snippets for using WSDoubleBorderSkin

  1. //
  2. //  [1] Define style properties:
  3. <mx:Style>
  4.     .wsDoubleBorder
  5.     {
  6.         borderSkin: ClassReference("skins.WSDoubleBorderSkin");
  7.         borderTopThickness: 3;
  8.         borderTopColor: #3ad2ed;
  9.         borderRightThickness: 3;
  10.         borderRightColor: #3399CC;
  11.         borderBottomThickness: 3;
  12.         borderBottomColor: #FF6600;
  13.         borderLeftThickness: 3;
  14.         borderLeftColor: #99CC00;         
  15.         backgroundColor: #FFFFFF;
  16.         backgroundAlpha: 90;
  17.         /*  Optionally: using one border only
  18.         doubleBorder: false;
  19.         */
  20.     }
  21. </mx:Style>
  22. //
  23. //  [2] Point these styles to a container, e.g. Canvas:
  24. <mx:Canvas id="standardCanvas"
  25.     styleName="wsDoubleBorder" />   
  26. //
  27. //  [2 b] Optionally: Using common properties "borderThickness"
  28. //  and "borderColor" for using one color or one thickness
  29. //  without any style definitions within <mx:Style>:
  30. <mx:Canvas id="standardCanvas"
  31.     width="300" height="200"
  32.     borderSkin="skins.WSDoubleBorderSkin"
  33.     borderThickness="3" borderColor="#99CC00" backgroundColor:"#FFFFFF" />
  34. // 
  35. //  That’s all ;)
  36.  
  37.  

Example (incl. source code)

Here you’ll find an example including the source code. WSDoubleBorderSkin is open source licensed under the Mozilla Public License 1.1.

Have fun! ;-)

Related Articles

Flex | Open Source

 

4 Comments

 

Leave a comment

*