我怎样才能绑定actionscript中存在的属性,例如我希望图像仍然在中间应用程序中..在mxml中我做这个简单的 />; ...我不知道如何在没有事件处理程序的情况下在actionscript中完成这个简单的操作...我将此代码放入application_creationCompleteHandler..
类似于 var image:Image = new Image(); image.source="图片.jpg"; image.x=this.width/2;
或者我把它放到另一个函数中?我不能做例如 updateComplete 事件处理程序并在那里更改它...
谢谢
帕维尔
how can i do binding exists property in actionscript e.g. i want image still in middle aplication..in mxml i do this simple as <mx:Image source="image.jpg" x="{this.width/2}"
/> ...i don't know how can i do this simple in actionscript without event handlers... i put this code to application_creationCompleteHandler..
something like var image:Image = new Image(); image.source="image.jpg"; image.x=this.width/2;
or have i put this to another function?? i can't do e.g. updateComplete event handler and change it there...
thanks
pavel
发布评论
评论(2)
检查BindingUtils 类及其bindSetter 方法。您可以将 setter 绑定到“width”属性,并在该处理程序中调整图像的 x 属性。
Check the BindingUtils class and its bindSetter method. You can bind a setter to the "width" property and adjust the x property of your image in that handler.
考虑到 as3 是面向对象的语言,我总是从这样的开始:
Considering that as3 is OO language i always start from something like this: