是否可以使用 Spark 组件架构在 MXML 中创建可换肤组件?
有很多关于如何使用新的 Spark 组件架构在 AS3 中创建可换肤组件的示例,但是我还没有找到任何使用 MXML 的此类示例。
我主要指的是定义皮肤部位和皮肤状态。似乎 SkinPart 元数据应该与属性相关联,因此不能在 MXML 中使用,这是正确的吗?
There are lots of examples of how to create skinnable components in AS3 using the new Spark component architecture, however I've yet to find any such examples using MXML.
What I'm mainly referring to is defining the skin parts and skin states. It seems as though the SkinPart metadata is supposed to be associated with properties and as such can't be used in MXML, is this correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,这是不可能的,因为 - 正如您正确指出的那样,无法在 MXML 中分配属性级元数据。
但是在 MXML 中声明皮肤契约似乎违背了 Skinning 架构的精神,即将组件的视图与其实现逻辑分开。
而且,考虑到在 MXML 中声明的所有内容都有一个值,它本质上将组件与皮肤耦合在一起。
即:
vs
同样,大多数组件逻辑本身最终会出现在
块中,这可能更适合放在单独的类中。As far as I can tell, this isn't possible, because - as you rightly pointed out, there's no way to assign property-level metadata in MXML.
But declaring skin contracts in MXML seems like it would go against the spirit of the Skinning architecture, which is to separate the view of the component from it's implementation logic.
And, given that in MXML everything declared has a value, it inherently couples the component to a skin.
Ie:
vs
Likewise, most of the component logic itself would end up in a
<fx:Script />
block, which would probably be better suited in a seperate class.