2012-01-22 12 views
1

以前と同じようにhostComponentの動作が停止しているようです。私がSkinnableContainerと言うことに基づいてカスタムのコンプを作成し、デフォルトのスキンを適用すると、スキンからBindable/public変数のヒントが表示されません。説明するためのコード。Flex 4.6のhostComponentは動作しなくなりましたか?

私はここで何が欠けていますか?他のコンポーネント/スキンでも同じように見えます。最新のFlash Builder(4.6)を使用しています。

< ---------コンポーネント--------------->

<?xml version="1.0" encoding="utf-8"?> 
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" 
         width="400" height="300" skinClass="skins.testSkin"> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 

    <fx:Script> 
     <![CDATA[ 

      [Bindable] 
      public var test:String = "Test"; 

     ]]> 
    </fx:Script> 
</s:SkinnableContainer> 

< ----------- ------スキン-------------->

<?xml version="1.0" encoding="utf-8"?> 
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled="0.5"> 

    <fx:Metadata> 
    <![CDATA[ 
     /** 
     * @copy spark.skins.spark.ApplicationSkin#hostComponent 
     */ 
     [HostComponent("spark.components.SkinnableContainer")] 
    ]]> 
    </fx:Metadata> 

    <fx:Script fb:purpose="styling"> 
     <![CDATA[   
      /** 
      * @private 
      */ 
      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void 
      { 
       this.hostComponent 
       // Push backgroundColor and backgroundAlpha directly. 
       // Handle undefined backgroundColor by hiding the background object. 
       if (isNaN(getStyle("backgroundColor"))) 
       { 
        background.visible = false; 
       } 
       else 
       { 
        background.visible = true; 
        bgFill.color = getStyle("backgroundColor"); 
        bgFill.alpha = getStyle("backgroundAlpha"); 
       } 

       super.updateDisplayList(unscaledWidth, unscaledHeight); 
      } 
     ]]>   
    </fx:Script> 

    <s:states> 
     <s:State name="normal" /> 
     <s:State name="disabled" /> 
    </s:states> 

    <!--- Defines the appearance of the SkinnableContainer class's background. --> 
    <s:Rect id="background" left="0" right="0" top="0" bottom="0"> 
     <s:fill> 
      <!--- @private --> 
      <s:SolidColor id="bgFill" color="#FFFFFF"/> 
     </s:fill> 
    </s:Rect> 

    <!-- 
     Note: setting the minimum size to 0 here so that changes to the host component's 
     size will not be thwarted by this skin part's minimum size. This is a compromise, 
     more about it here: http://bugs.adobe.com/jira/browse/SDK-21143 
    --> 
    <!--- @copy spark.components.SkinnableContainer#contentGroup --> 
    <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" minWidth="0" minHeight="0"> 
     <s:layout> 
      <s:BasicLayout/> 
     </s:layout> 
    </s:Group> 

</s:Skin> 
+0

スキンの '[HostComponent(" spark.components.SkinnableContainer ")]'ディレクティブは、コードヒントを取得したい場合は 'SkinnableContainer'だけでなく、カスタムコンポーネント(例えば' MyComponent')を指定する必要がありますvarsとメソッドについて。それはちょうどあなたの質問のタイプミスですか? – merv

+0

タイプミスはありませんでした。それは単純でした。前回はhostComponentを使用していました。私はそれをコード化しました...なぜ、Flash BuilderはカスタムhostComponentを追加しませんか?そして、「[HostComponent( "spark.components.SkinnableContainer")] "を使用することには何の使用もありますか?答えをありがとう、そのように追加し、私は受け入れます! :) – DominicM

答えて

1

Flash Builderが公開メソッドおよびプロパティのカスタムコンポーネントでは、カスタムコンポーネントをスキン内のHostComponent metadata directiveに指定する必要があります。現在、あなたがいて肌コード:

[HostComponent("spark.components.SkinnableContainer")] 

はどんなカスタムコンポーネントに例えば、あることを変更してみてください。 com.mydomain.MyComponent

関連する問題