7

MXMLコンポーネントでカスタムプロパティを定義するときは、そのプロパティの可能な値のセットを定義して、コード補完関数を呼び出したときにFlex Builderがその時点で表示するようにします(カスタムプロパティの可能な値)。

どのようにそれを行うことができるか考えていますか?

4

2 に答える 2

9

[Inspectable]メタタグをenumeration属性とともに使用します。

メタ[Inspectable]データ タグは、コードヒントおよび Flex Builder のプロパティインスペクター領域で公開するコンポーネントの属性に関する情報を定義します。

[Inspectable(defaultValue="abc", enumeration="abc,xyz,pqr")]
public var myProp:Boolean;
于 2010-06-21T05:29:38.833 に答える
1

私のように、カスタムコンポーネントのMxml部分は次のとおりです。

 <com:CustomWindow width="100" height="130" frontImageSrc="{rp.currentItem.path}" 
   showText="{rp.currentItem.imgtext}" hideImage="{rp.currentItem.noImage}" 
   buttonMode="true" useHandCursor="true" mouseChildren="true"/>

Actionscript 部分は次のとおりです: -

//Inspectable metadata tag gives you the option in the flex builder 
//to choose an option from the available selected options
//Put it with the getter of that particular property 

[Inspectable(defaultValue="true", enumeration="true,false")]
public function get showImage():Boolean
{
       return _imgVisible;
}
public function set showImage(str:Boolean):void
{
 _imgVisible = str;
}
于 2010-06-21T11:47:38.223 に答える