Trying to add a skinClass to

2019-09-09 20:41发布

问题:

I'm working with Flex4 and I'm trying to skin a form (add a background and a border to it, etc.)

I'm trying to do it the Flex 4 way with skinClass=""

<mx:Form skinClass="skins.MyFormSkin" />

but it's not accepting skinClass as a property.

How should I do it such that I'm still adhering to the best practices in Flex 4 (decoupling visuals from logic)?

回答1:

skinClass only works on spark components, which have tags starting with <s:



回答2:

To elaborate on Qz's response: mx:Form is not a Flex 4 spark component. It's still an old-style Flex 3 component and does not support skinning. The upcoming Hero release of the Flex SDK provides a new Flex 4 style Form (see http://blog.flexexamples.com/2010/08/28/creating-a-simple-spark-form-in-flex-hero/)

However, that's still pre-release code at this point. Depending on your project, Hero may or may not be appropriate.