SWC皮肤与Spark绘图API冲突
我有一个项目,我们正在尝试从第三方库中为 Spark 组件设计皮肤,这些组件是根据绘图 API 原语构建的。我们的第一次尝试涉及在 Illustrator/Flash 中创建 Flex 皮肤 (SWC),并通过 CSS 将该皮肤应用到 Spark 组件。我们发现,即使在舞台上只有一个组件实例以这种方式进行蒙皮,应用程序也会陷入瘫痪。例如,它无法及时响应重画场景,并表现出所有挂起的症状。
我们的下一个方法是在 MXML 类中重新创建相同的皮肤工件,这些工件又与第三方组件相关联。尽管某些皮肤的复杂性让我相信我们也可能无法避免这种方法的性能问题。
我的问题如下:是否有正确或推荐的方法将 SWC 或基于皮肤应用到从 Spark 绘图 API 构建的组件?即使我提出这个问题,我也认识到该方法意味着在两个地方使用 Spark 绘图 API,并且可能会产生意想不到的后果。
I have a project where we are trying to skin Spark components from a third party library that are built up from the drawing API primitives. Our first attempt involved creating a Flex skin (SWC) in Illustrator/Flash and applying that skin to the Spark components via CSS. We found that even with only a single instance of one of the components skinned in this way on stage, the application was brought to it's knees. For example, it failed to respond in repaint scenarios in a timely manner, and exhibited all the symptoms of being hung.
Our next approach will be to recreate the same skin artifacts in MXML classes that are in turn associated with the third-party components. Although the complexity of some of the skins leads me to believe that we might not avoid performance problems with this approach either.
My question is the following: Is there a correct or recommended way to apply either a SWC or based skin to a component that is built up from the Spark drawing API to begin with? Even as I ask the question I recognize that the approach means using the Spark drawing API in two places and will probably have unexpected consequences.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很幸运地使用在渲染性能方面继承自 s:Skin 的 MXML 皮肤类来构建皮肤。推荐的方法(来自 Adobe)是首先从 SDK 复制现有皮肤文件并修改 MXML 以满足您的需求。关于绘图,FXG 非常适合定义您希望如何绘制皮肤。 FXG 是基于 XML 的,因此您不需要编写 ActionScript 来进行绘图,就像我们过去为 Flex 3 编程皮肤所做的那样。您还可以使用 Adobe Catalyst 创建外观。我没有使用过 Catalyst,所以我无法评价它的有效性,但很多人似乎都喜欢它。希望有帮助。
I've had good luck building the skins using MXML skin classes that inherit from s:Skin in terms of rendering performance. The recommended method (from Adobe) is to start by copying an existing skin file from the SDK and modifying the MXML to suit your needs. Regarding drawing, FXG works very well for defining how you want the skin to be drawn. FXG is XML based, so you don't need to write ActionScript to do your drawing, like we used to do for Flex 3 programmatic skins. You can also create skins using Adobe Catalyst. I have not used Catalyst, so I can't speak to its effectiveness, but many people seem to like it. Hope that helps.