Flex 当 mxml 描述的组件初始化它的 mxml 描述的属性时
我正在尝试覆盖 Button 类,我有一些属性,我希望直接使用组件的 mxml 描述进行初始化,例如:
<sl:TMyButton id="btnX" x="168" y="223" width="290" label="Button" myproperty1="10" myproperty2="101" myproperty3="4"/>
当具有 mxml 描述的所有属性完全初始化时,会触发哪个函数(以便覆盖它)他们的价值观?
I am trying to override a Button class, i have a few properties which i wish directly initialise with the mxml description of the component, like :
<sl:TMyButton id="btnX" x="168" y="223" width="290" label="Button" myproperty1="10" myproperty2="101" myproperty3="4"/>
which function is triggered ( in order to override it ) when all properties with mxml description is fully initialised with their values ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flex 组件 在
中有 4 个方法protected
命名空间应被覆盖以解决不同的任务:createChildren()
— 调用一次以创建和添加子组件。measure()
来计算组件尺寸。updateDisplayList()
将真实组件未缩放的宽度和高度作为参数。显然这种方法对于儿童的定位来说是很方便的。commitProperties()
是我建议您重写的方法,以便应用不需要应用组件大小的属性值。因此,在您的情况下,它可以是
updateDisplayList()
或commitProperties()
。我向您推荐以下代码片段:希望这有帮助!
Flex components have 4 methods in
protected
namespace which should be overridden to solve different tasks:createChildren()
— calls one time to create and add subcomponents.measure()
called in process of lay outing to calculate components size.updateDisplayList()
has real component unscaled width and height as parameter. It is obvious this method is convenient for positioning of children.commitProperties()
is the method I suggest you to override in order to apply properties values which don't need component size to apply.So in your case it can be
updateDisplayList()
orcommitProperties()
. I recommend you the following code snippets:Hope this helps!