Mind the Flex

Windows Classic skin for Flex 3: Updated

September 29th, 2008 | Posted by sven-
Filed under Flex |

During this weekend I have updated my Windows classic skin for Flex. See original blog entry for details, or go directly to the demo page by clicking here. Transition to release 3 wasn't smooth enough. Some skinning components worked consistently even from Flex 2.0.1 to Flex 3 beta3 broke with the final SDK.

There was a long and although not very friendly thread (see Panel contents overlap when using borderSkin [SDK-14806]). I completely understand the folks who are attempting to migrate large apps from Flex 2 to Flex 3 and should now manually adjust all of the controls. I'am also working on a relatively mission-critical Flex project in a banking environment, but we are using fortunately only modified Halo theme. I have waited with interest to see Adobe's reaction. I personally think that, for now, advanced skinning solutions in the production environments should wait a little bit more.

Panel is no longer using scaleGrid values for border metrics:


Since I'm using anyway extended Panel class, I overrided get viewMetrics() method:

  1.  
  2. public var skinBorder:Object;
  3. ...
  4. override public function get viewMetrics():EdgeMetrics {
  5. return new EdgeMetrics(skinBorder[0], skinBorder[1], skinBorder[2], skinBorder[3]);
  6. }
  7.  

The MXML looks like:

  1.  
  2. <ResizableWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
  3. layout="absolute" width="720" height="480" creationComplete="initApp();"
  4. title="My application" showControls="true"
  5. enableResize="true" skinBorder="[6,32,6,6]">
  6. ...
  7. </ResizableWindow>
  8.  

The same border issue in DG. You can see the skinned border by setting DataGridColumn backgroundAlpha to 0 or create DG without columns.

  1.  
  2. package {
  3. import mx.controls.DataGrid;
  4. import mx.core.EdgeMetrics;
  5. import mx.core.ScrollPolicy;
  6.  
  7. public class MyDataGrid extends DataGrid {
  8. public var skinBorder:Object;
  9.  
  10. public function MyDataGrid() {
  11. super();
  12. }
  13.  
  14. override public function get viewMetrics():EdgeMetrics {
  15. var vScrollBarWidth:int;
  16. var hScrollBarHeight:int;
  17. if (verticalScrollPolicy == ScrollPolicy.AUTO && verticalScrollBar && verticalScrollBar.visible)
  18. vScrollBarWidth = this.verticalScrollBar.width;
  19. if (horizontalScrollPolicy == ScrollPolicy.AUTO && horizontalScrollBar && horizontalScrollBar.visible)
  20. hScrollBarHeight = this.horizontalScrollBar.height;
  21.  
  22. return new EdgeMetrics(
  23. skinBorder[0],
  24. skinBorder[1],
  25. skinBorder[2]+vScrollBarWidth,
  26. skinBorder[3]+hScrollBarHeight);
  27. }
  28. }
  29. }
  30.  

Declaring DG in MXML:

  1.  
  2. <MyDataGrid horizontalScrollPolicy="auto" id="myGrid" skinBorder="[2,2,1,2]">
  3. ...
  4. </MyDataGrid>
  5.  

 

5 Responses to “Windows Classic skin for Flex 3: Updated”

  1. Windows classic skin for Flex 3 | Mind the Flex Says:

    […] See also: Windows classic skin for Flex 3: Updated […]

  2. Kirk Pinneo Says:

    Excellent skin, do you plan on providing source code for the demo?
    Thanks Kirk

  3. Eugene Says:

    Nice article. Thanks. :) Eugene

  4. Windows Classic skin for Flex 3: Updated « dailytuts.net Says:

    […] Read more: Windows Classic skin for Flex 3: Updated […]

  5. Josh Says:

    It’s hard to get this working correctly without documentation and no demo source code.

Leave a Reply