0 Replies Latest reply on Aug 7, 2010 3:55 PM by elekwent

    Inconsistencies between an MXML tag instance's properties and an Actionscript instance's properties


      Hi everyone!  I've been using the SDK for several months, but I've only been using Flash Builder for a few weeks.  I finished the Flex In a Week videos and exercises a few days ago, and since then I've been playing around with the accompanying exercises.


      My question specifically refers to the PanelSkin.mxml file from 'Exercise 5.6: Creating custom skin properties'.  In this example, the function initTitleSkin() sets the 'headerSkinColor.color' property to a value passed from the main application:



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

      <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"






              <s:State name="normal" />

              <s:State name="disabled" />










                  private function initTitleSkin():void


                      headerSkinColor.color = hostComponent.panelTitleColor;







      <s:Rect radiusX="4" radiusY="4" height="100%" width="100%" >


                <mx:SolidColor id="panelSkin" color="#E8E8E8"/>





      <s:Path winding="nonZero" data="M 0.016 0.012 L 0.016 23.354 L 287.419 23.354 L 287.408 12.012 C 287.408 5.385 282.035 0.012 275.408 0.012 L 0.016 0.012 Z">



                <s:SolidColor id="headerSkinColor"/>





      <s:Label id="titleDisplay" lineBreak="explicit" left="10" right="4" top="2" height="30" verticalAlign="middle" fontWeight="bold"/>



      <s:Group id="contentGroup" top="23">







      This code works just fine.  I tried extending this example by setting the 'titleDisplay.color' property in the same way.  The 'titleDisplay' is an instance of the Label class.


           private function initTitleSkin():void


                      headerSkinColor.color = hostComponent.panelTitleColor;

                      titleDisplay.color = hostComponent.panelLabelColor;



      The above code results in the error 'Access of possibly undefined property color through a reference with static type spark.components:Label'.


      I set up the custom 'panelLabelColor' property and confirmed the 'hostComponent.panelLabelColor' property is being passed to the custom skin class correctly.  My question is, Why can I set the 'color' property in the MXML Label block, but not from the ActionScript instance.  The Language Reference shows the spark Label has a 'color' property.  Code Assist shows the 'color' property in the MXML block, but not in the ActionScript instance.  Am I missing something simple that's staring me right in the face?  I'm usually pretty good at that.  I'd appreciate any thoughts on this inconsistency.