Flex3和Flex4中Halo和Spark有什么区别?
Flex3和Flex4中Halo和Spark有什么区别?
Possible Duplicate:
What are the downsides to using Spark over Halo in Flex?
What is the difference between Halo and Spark in Flex3 and Flex4?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
许多其他答案都集中在主题上;虽然 Halo 和 Spark 确实有默认主题;我认为这就像说将本田思域与保时捷进行比较并关注轮胎一样。
Spark 和 Halo 之间的主要区别实际上在于用于构建组件的底层架构。 Halo 是 Flex 2[和 3] 架构,并具有 createChildren 等方法()、commitProperties()、measure() 和 updateDisplayList()。要构建组件,您将在自己的组件中重写这些方法,该组件在类层次结构中的某个位置扩展了 UIComponent。有时这称为 MX 架构。
在 Halo 方法中,所有视觉设计和业务逻辑都合并到同一个类文件中。 Spark 架构是 Flex 4 中引入的新架构这使得在蒙皮和构建组件时具有更大的灵活性。它使用两类系统,一个类是包含业务逻辑的组件类,另一个类是执行视觉显示的外观类。
Spark 组件有一个新的父组件,名为 SkinnableComponent。 SkinnableComponent 实际上继承了 UIComponent,所以原来的生命周期方法还在;但 SkinnableComponent 提供了新的钩子,因此我们以不同的方式创建组件。例如,我们不会重写 createChildren(),而是重写partAdded() 或partRemoved()。作为另一个示例,所有 updateDisplayList() 和measure() 代码都移至外观类中。
此外,Halo 和 Spark 还有一组单独的 UI 组件。 Spark 组件以更轻、更灵活而闻名,但它们的功能也较少。例如,Spark Combobox 不具有与 Halo Combobox 相同的 API。
围绕相关组件生态系统的工具也是一个考虑因素。例如,Flash Catalyst 仅适用于 Spark 组件。
A lot of other answers focus on the themes; and while Halo and Spark do have default themes; I think that is like saying comparing a Honda Civic to a Porsche and focusing on the tires.
The main difference between Spark and Halo really get at the underlying architecture used for building components. Halo is the Flex 2[and 3] architecture and has methods like createChildren(), commitProperties(), measure(), and updateDisplayList(). To build components, you will override these methods in your own component, which extends UIComponent somewhere in the class hierarchy. Sometimes this is called the MX Architecture.
In the Halo approach, all visual design and business logic were combined into the same class file. The Spark architecture is a new architecture introduced in Flex 4 that allows for greater flexibility when skinning and building components. It uses a two class system, with one class being the component class that will contain business logic and the other class being the skin class which will perform the visual display.
Spark components have a new parent component, named SkinnableComponent. SkinnableComponent actually extends UIComponent, so the original lifecycle methods are still there; but SkinnableComponent provides new hooks so we create components differently. Instead of overriding createChildren() we would override partAdded() or partRemoved(), for instance. All updateDisplayList() and measure() code is moved into the skin class as another example.
Additionally, there is a separate set of UI components for Halo and Spark. Spark components are known for being lighter and more flexible, but they also have less features. A Spark Combobox does not have the same API as the Halo Combobox for example.
Tooling around the relative component ecosystem is also a consideration. Flash Catalyst will only work with Spark components, for example.
Spark 是 Flash builder 4 (Flex4) 中引入的新主题(除了 Halo 之外)。这两个主题支持不同类型的风格。使用 Flex4,您可以根据应用程序的设计考虑因素选择要使用的一种。如果您想在组件上使用自定义皮肤,Spark 会更方便;另一方面,Halo 有更多内置的组件样式。
Spark is a new theme introduced (in addition to Halo) with Flash builder 4 (Flex4). These two themes support different kinds of styles. With Flex4, you can choose which one you want to use depending on design considerations for your application. Spark is more convenient if you want to use custom skins on your components; Halo, on the other hand, has more built-in styles for components.
阅读有关该主题的 Adobe 文档:
http://www.adobe.com/devnet/ flex/articles/flex3and4_differences.html
状态的差异一开始让我感到困惑。
Read Adobe's documentation on the subject:
http://www.adobe.com/devnet/flex/articles/flex3and4_differences.html
The differences in state threw me for a loop at first.