用户名: 密码: 验证码: QQ--程序群:31736530 动画群:38836599
闪无忧
 
首 页 业界新闻 业界杂谈 Flash教程 Flash源码 Flash图书 Flash酷站 Flex & AIR 供求信息
   本栏目通告:   请大家多多关注[Flex应用案例],更希望大家[推荐好的案例]给我们
当前位置 :首页>Flex-AIR>Flex资料>列表

flex creationComplete事件的一些思考

[来源:gain-loss.org | 作者:gain-loss.org | 时间:2008-09-02 | 点击:  | 收藏本文  【 】]

creationComplete恐怕是flex用的最多的事件了,不管啥,application标签后面接个creationcomplete事件处理函数,做为程序的起点。这种做法是没错的,可是有些时候它也不是都管用。先看看来自devguide_flex3的论述:

  • The preinitialize event occurs too early in the component life cycle for most initialization activities. It is useful, however, in the rare situations where you must set the properties on a parent before the children are created.
  • To configure a component before Flex has determined its visual appearance, use the initialize event. For example, use this for setting properties that affect its appearance, height, or width.
  • Use the creationComplete event for actions that rely on accurate values for the component’s size or position when the component is created. If you use this event to perform an action that changes the visual appearance of the component, Flex must recalculate its layout, which adds unnecessary processing overhead to your application.
  • Use the updateComplete event for actions that must be performed each time a component’s characteristics change, not just when the component is created.

这是flex components initialization lifecycle里论述的关于组件初始化的过程(个人认为这是flex的超级重点)。其它事件不看了。creationcomplete事件发生在某个组件(以及它的子组件)完全建立的时候,包括样式,大小,布局完成。也就是讲,是你能看到UI的时候。它隐含了一些意思在里面(个人经验之谈),很可能在实际操作过程中被忽略掉。

  • 必须可见。我在这点上吃了几次亏。creationcomplete的时机是布局已经完成的时刻,那如果某些子组件不在布局之内呢,比如tag navigator, viewstack(其它的我没试过,不好讲)。它的还没被选中的子组件就没有初始化,访问它就报错了。
  • 只发生一次。就是建立的时候,如果以后布局有变化,发出的是updatecomplete事件。
  • 每个组件都有。除了application,还有它的子组件,子组件的子组件… 。地球人都有呀。这一点可以做为第一点的解决方案,就是在子组件里各自建立creationcomplete的处理函数,这样对数据模块化也有好处。
文章如果有错误或者缺少文件,请发邮件提交给我们
上一篇:Flex 3D-Album Component
下一篇:如何安装flex builder for linux在ubuntu
Tags:    
>>> 最新评论:(共有 0 位网友发表了评论)      查看所有评论
  发表评论
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
·本站发布内容均为客观表达作者观点,不代表闪无忧立场,请勿攻击和漫骂
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
  Flex及AIR分类
  Flex资料   Flex动态
  Flex案例   Flex源码
  AIR资讯
  Flex相关
  寻找Flex工作机会
  发布Flex工作机会
  相关文章
·超酷的Flex Efflex库分享
·aswing的使用心得
·自定义itemRenderer引发的诡异问
·AutoQueryTextInput Flex组件介
·NetBeans支持Flex 开发插件
·如何安装flex builder for linux
·flex creationComplete事件的一
·Flex 3D-Album Component
·Eclipse 3.4上使用FlexBuilder介
·Getting Started With Adobe Fle
  热门文章
·Flex 3 AdvancedDataGrid的使用(第二
·用Adobe Flex 2和Java创建富Internet
·Flex中文官方帮助教程下载
·FLEX地图应用教程之一
·如何从零开始编写一个flex组件
·用Flex 3做AIR版html编辑器
·学习Flex几个值得研究的例程代码
·Flex 入门教程
·Flex 3 dvancedDataGrid的使用(第一部
·如何自定义Flex的loading画面
·基于Flex的在线图片编辑器
关于我们 - 免责声明 - 网站地图 - 商务服务 - 联系我们 - RSS地图
©CopyRight 2006-2008, 5UFlash.COM, Inc. All Rights Reserved
鲁ICP备06034971号