注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

神魔破杜梓的叨叨堂

Programming every day!

 
 
 

日志

 
 
 
 

创建Flex组件的步骤  

2008-09-02 20:50:00|  分类: My Tech |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

原文来自Adobe live doc

When you implement a component, you override component methods, define new properties, dispatch new events, or perform any other customizations required by your application.

To implement your component, Follow these general steps:

  1. If necessary, create any skins for the component.
  2. Create an ActionScript class file.
    1. Extend one of the base classes, such as UIComponent or another component class.
    2. Specify properties that the user can set by using an MXML tag property. For more information, see Creating Simple Visual Components in ActionScript.
    3. Embed any graphic and skin files. For more information, see Creating Simple Visual Components in ActionScript.
    4. Implement the constructor.
    5. Implement the UIComponent.createChildren() method.
    6. Implement the UIComponent.commitProperties() method.
    7. Implement the UIComponent.measure() method.
    8. Implement the UIComponent.layoutChrome() method.
    9. Implement the UIComponent.updateDisplayList() method.
    10. Add properties, methods, styles, events, and metadata.
  3. Deploy the component as an ActionScript file or as a SWC file.

You do not have to override all component methods to define a new component. You only override the methods required to implement the functionality of your component. If you create a subclass of an existing component, such as Button control or VBox container, you must implement the methods necessary for you to add any new functionality to the component.

For example, you can implement a custom Button control that uses a new mechanism for defining its default size. In that case, you only need to override the measure() method. For an example, see Implementing the measure() method.

Or, you might implement a new subclass of the VBox container. Your new subclass uses all of the existing sizing logic of the VBox class, but changes the layout logic of the class to lay out the container children from the bottom of the container to the top, rather than from the top down. In this case, you only need to override the updateDisplayList() method. For an example, see Implementing the updateDisplayList() method.

  评论这张
 
阅读(376)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017