5 Replies Latest reply on Oct 13, 2011 2:10 PM by Jared Ivory

    Flex 4 to Flex 4.5 - Spark Label no longer has width, left, and right properties?

    Gregory Lafrance Level 6

      I'm converting an app from Flex 4 to Flex 4.5, and this code (snippet) from my custom skin no longer works:

       

      <s:Label id="labelDisplay"
          textAlign="left"
          verticalAlign="middle"
          maxDisplayedLines="1"
          horizontalCenter="0" verticalCenter="1"
          left="10" right="20" top="-4" bottom="2"
          color="#333333" fontSize="12" fontFamily="arial"
          fontWeight="bold"
          color.upAndSelected="#003399" 
          color.overAndSelected="#003399"
          color.over="#858585"
          creationComplete="setTabWidth();">
      </s:Label>
      
      [Bindable] private var labelDisplayWidth:Number = 0;
      
      private function setTabWidth():void{
          labelDisplayWidth = labelDisplay.width + labelDisplay.left 
          + labelDisplay.right + 3;
      }
      


      I'm getting these errors when compiled with Flex SDK 4.5:

       

      Access of possibly undefined property left through a reference with static type spark.core:IDisplayText.

      Access of possibly undefined property right through a reference with static type spark.core:IDisplayText.

      Access of possibly undefined property width through a reference with static type spark.core:IDisplayText.

       

      Can I not access the "width" property of a Spark Label in Flex 4.5? How about the left and right properties? Do I need to use getStyle() for those?