The lifecycle of component in flex is certainly somewhat similar to the old V2 framework where you create a component holder, craetechildren, set-sizes and dispatch events. Following four methods plays a role for component rendering
- commitProperties()
- measure()
- layoutChrome()
- updateDisplayList()
Here is what I found after doing some studies. The most of the following part is taken from Adobe flex help however what I am trying to do here is to elaborate it more by putting up some comments to each step to make it clearer.
The green comments shows the methods and events performed by or on component itself whereas the comments in blue represents the methods and events performed on or by the parent container.
Following steps are demonstrating the Button component life cycle
-
Given if the component is going to be in a container then the parent property of component will be referred to the container(DisplayObjectContainer type)
//– A property for UIComponent class
- Get the style settings of the component
-
Dispatches the preinitialize event on the component.
//– The preinitialize event(mx.events.FlexEvent) is triggered when the UIComponent is in a very raw stage and there is no children in existence at that time
-
Calls the component’s createChildren() method.
createChildren is a protected method of UIComponent class which we need to override when we create a subclass of the UIComponent. Also from within an override of the createChildren() method, you call the addChild() method to add each child object.
You do not call this method directly. Flex calls the createChildren() method in response to the call to the addChild() method to add the component to its parent.
- Calls the invalidateProperties(), invalidateSize(), and invalidateDisplayList() methods to trigger later calls to the commitProperties(), measure(), or updateDisplayList() methods during the next render event.
invalidateProperties() marks a component so that its commitProperties() method gets called during a later screen update.
invalidateSize () Marks a component so that its measure() method gets called during a later screen update.
invalidateDisplayList () Marks a component so that its updateDisplayList() method gets called during a later screen update.
The only exception to this rule is that Flex does not call the measure() method when the user sets the height and width of the component.
- Dispatches the initialize event on the component. At this time, all of the component’s children are initialized, but the component has not been sized or processed for layout. You can use this event to perform additional processing of the component before it is laid out.
Initizlize event gets dispatched when the component has finished its construction and has all initialization properties set.
After the initialization phase, properties are processed, the component is measured, laid out, and drawn. After which the creationComplete event is dispatched.
- Dispatches the childAdd event on the parent container.
The childAdd event is dispatched when the addChild() or addChildAt() method is called. At the time when this event is sent, the child object has been initialized, but its width and height have not yet been calculated, and the child has not been drawn on the screen. If you want to be notified when the child has been fully initialized and rendered, then register as a listener for the child’s creationComplete event.
- Dispatches the initialize event on the parent container.
Dispatched when the component has finished its construction and has all initialization properties set. After the initialization phase, properties are processed, the component is measured, laid out, and drawn, after which the creationComplete event is dispatched.
-
During the next render event, Flex performs the following actions:
-
Calls the component’s commitProperties() method.
commitProperties() processes the properties set on the component. You do not call this method directly. Flex calls the commitProperties() method when you use the addChild() method to add a component to a container, or when you call the invalidateProperties() method of the component. Calls to the commitProperties() method occur before calls to the measure() method. This lets you set property values that might be used by the measure() method.
-
Calls the component’s measure() method.
Measure() calculates the default size, and optionally the default minimum size, of the component. This is an advanced method that you might override when creating a subclass of UIComponent.
The default implementation of measure() sets measuredWidth, measuredHeight, measuredMinWidth, and measuredMinHeight to 0.
-
Calls the component’s (Adobe help mention this method is in UIComponent where as it is in container class) container’s layoutChrome() method.
The Container class, and some subclasses of the Container class, use the layoutChrome() method to define the border area around the container.
-
Calls the component’s updateDisplayList() method.
The updateDisplayList() method sizes and positions the children of your component based on all previous property and style settings, and draws any skins or graphic elements that the component uses. The parent container for the component determines the size of the component itself.
-
Dispatches the updateComplete event on the component.
Dispatched when an object has had its commitProperties(), measure(), and updateDisplayList() methods called (if needed).
This is the last opportunity to alter the component before it is displayed. All properties have been committed and the component has been measured and layed out.
- Flex dispatches additional render events if the commitProperties(), measure(), or updateDisplayList() methods call the invalidateProperties(), invalidateSize(), or invalidateDisplayList() methods.
-
After the last render event occurs, Flex performs the following actions:
- Makes the component visible by setting the visible property to true.
- Dispatches the creationComplete event on the component. The component is sized and processed for layout. This event is only dispatched once when the component is created.
- Dispatches the updateComplete event on the component. Flex dispatches additional updateComplete events whenever the layout, position, size, or other visual characteristic of the component changes and the component is updated for display.
原文链接:http://flexcomps.wordpress.com/2008/05/09/flex-component-life-cycle/
相关文章:http://danorlando.com/?p=122
- 大小: 92.4 KB
分享到:
相关推荐
白色简洁风格的韩国个人网页源码下载.zip
基于AT89C51的超声波测距
白色宽屏风格的室内设计公司整站网站源码下载.zip
白色简洁风格的眼睛设计制作企业网站模板.zip
基于Mysql和OpenCV的人脸识别系统(源码和部署教程).zip。内容来源于网络分享,如有侵权请联系我删除。另外如果没有积分的同学需要下载,请私信我。
“预防夏季中暑”知识讲座教案课件
Java毕业设计-基于springboot+vue的在线教育平台源码+文档+视频教程 系统说明: 3.3 角色功能分析 3.3.1 管理员用例分析 数据统计:管理员可以查看系统的数据统计信息,如用户数量、订单数量等。 轮播管理:管理员可以管理系统首页的轮播图内容,包括添加、编辑、删除等操作。 课程管理:管理员可以管理系统中的课程信息,包括审核待审批的课程、编辑课程内容等。 分类管理:管理员可以管理课程的分类信息,包括添加、编辑、删除分类。 讲师管理:管理员可以管理系统中的讲师信息,包括审核讲师入驻申请、编辑讲师信息等。 学员管理:管理员可以管理系统中的学员信息,包括查看学员列表、禁用学员账号等。 用户管理:管理员可以管理系统中的用户信息,包括查看用户列表、禁用用户账号等。 订单管理:管理员可以管理系统中的订单信息,包括查看订单列表、处理订单退款等操作。如下图3-1所示: 图3-1 管理员用例图 管理员用例表描述了管理员在黑板擦在线教育系统中的常见操作,包括登录系统、数据统计、轮播管理、课程审核和分类管理等。管理员首先通过输入用户名和密码登录系统,然后可以查看系统的数
采用QT写了一个基于UDP协议的数据发送小程序,可以发送自定义帧结构数据和记录的数据文件,使用方便。
其实这就是历年摘出来的
在传统信息管理方法中,我们面临诸多挑战:处理信息耗时、数据错误率高、数据修正困难以及数据检索不便。为了解决这些问题,引入计算机化的疫苗预约系统软件显得尤为重要,这样的系统不仅能够规范信息管理流程,实现管理工作的系统化和程序化,还能帮助管理人员准确、迅速地处理信息。 在开发工具的选择上,我们经过慎重考虑,最终选择了Eclipse作为开发工具,以及Mysql作为数据库工具,以便于实现疫苗预约系统的各项功能。系统的核心功能包括管理员对用户的管理以及新闻公告的发布。 疫苗预约系统是一款基于软件开发技术构建的应用系统,它在信息处理方面表现出色,无论是数据的快速添加、维护、统计还是查询,都能轻松应对,极大地提高了信息处理的速度和准确性。
基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目),本资源中的源码都是经过本地编译过可运行的,评审分达到98分,资源项目的难度比较适中,内容都是经过助教老师审定过的能够满足学习、毕业设计、期末大作业和课程设计使用需求,如果有需要的话可以放心下载使用。 基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python的二手房数据分析完整源码+说明文档+分析报告+数据(高分项目)基于python
白色宽屏风格的肉制品销售企业网站模板.zip
白色简洁风格的房产交易中心企业网站源码下载.zip
白色简洁风格的高级西餐牛排模板下载.zip
漂亮的收款打赏要饭网HTML页面源码,一款简洁而美观的HTML页面,专为个人收款和接受他人打赏而设计
白色简洁风格的网上眼镜商城网站源码下载.zip
白色卡通精致的机器人企业网站模板下载.zip
知攻善防-应急响应靶机-web2.z22