开发者

Is there a way to declare a skin inline?

开发者 https://www.devze.com 2023-01-23 07:43 出处:网络
Is there a way to declare a skin开发者_如何学JAVA inline in a Flex 4 MXML Component? If not inline in the component then in the declarations or library tag? ThxYes you can in the declarations tag:

Is there a way to declare a skin开发者_如何学JAVA inline in a Flex 4 MXML Component? If not inline in the component then in the declarations or library tag? Thx


Yes you can in the declarations tag:

<s:Application>

<fx:Declarations>
    <fx:Component className="testSkin">
        <s:Skin>
            <s:Rect width="100%" height="100%">
                <s:fill>
                     <s:SolidColor/>
                </s:fill>
            </s:Rect>
            <s:Group id="contentGroup"/>
        </s:Skin>
    </fx:Component>  
</fx:Declarations>

<s:SkinnableContainer skinClass="{Class(testSkin)}"/>

</s:Application>

The above code is merely guidance, don't expect it to compile.

In my tests, there is no performance penalty to using inline skins.


Use the skinClass style.

In MXML, like this:

<s:List skinClass="com.myCustomSkins.MyCustomListSkin" />

In ActionScript, do something like this:

 myListClass.setStyle('skinClass',com.myCustomSkins.MyCustomListSkin);

In CSS, do something like this:

myListClass{
 skinClass : ClassReference(com.myCustomSkins.MyCustomListSkin);
}

I'm not sure what a library tag is that you refer to in your question. This code is from memory, so my syntax may be a bit off.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号