3 Replies Latest reply on Jun 24, 2009 3:19 PM by Jason Szeto

    Spark scaleGrid while skinning

    Olof Brickarp

      Howdy!

       

      I've been skinning in Flex 3 for a while now and wanted to try my luck with Spark as well, using images. After getting my head around the concept it looked promising. Skinning "static" components such as radiobuttons and checkboxes was a bliss. But I got stuck when I were trying to use the scaleGrid. I use this in Flex 3 all the time and it works like a charm. But all I get in Flex 4 is this error message:

       

      ArgumentError: Error #2004: One of the parameters is invalid.
          at flash.display::DisplayObject/set scale9Grid()
          at spark.components::Group/updateDisplayList()[E:\dev\beta1\frameworks\projects\flex4\src\sp ark\components\Group.as:844]
          at mx.core::UIComponent/validateDisplayList()[E:\dev\beta1\frameworks\projects\framework\src \mx\core\UIComponent.as:7691]
          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\beta1\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:663]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\beta1\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:718]
          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\beta1\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1067]

       

       

      I could not find anything on the subject in the help and the only relevant thing I found on google was this: http://bugs.adobe.com/jira/browse/SDK-21425 (which is pretty much the same error that I get). I tried setting the width and measuredWidth of the images that make up the component but nothing worked. There might be a really simple solution for this and I guess it could be a matter of understanding the concept.

       

      Here's my source code (HSliderTrack);

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Skin xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:th="http://ns.adobe.com/thermo/2009"
           xmlns:mx="library://ns.adobe.com/flex/halo"

           scaleGridTop="4" scaleGridBottom="6" scaleGridLeft="5" scaleGridRight="189"
           height="9" maxHeight="9" width="100%">
         
      <s:states>
        <s:State name="up"/>
        <s:State name="over"/>
        <s:State name="down"/>
        <s:State name="disabled"/>
      </s:states>
         
      <s:BitmapImage source="@Embed('assets/Slider/trackSkin.png')" id="sliderTrack" includeIn="up, over, down" resizeMode="scale" width="100%" height="9" maxHeight="9" measuredWidth="194" measuredHeight="9" />


      <s:BitmapImage source="@Embed('assets/Slider/trackSkin.png')" id="sliderTrackDisabled" includeIn="disabled" alpha="0.3" resizeMode="scale" width="100%" height="9" maxHeight="9" measuredWidth="194" measuredHeight="9" />
         
      </s:Skin>

       

      Many thanks in advance!