数据绑定将无法检测对“topLevelApplication”的分配。
我正在将应用程序从 Flex 3 迁移到 Flex 4。 在某些情况下,弹出窗口的宽度和高度与应用程序的宽度和高度绑定。
width="{Application.application.width - 24}"
height="{Application.application.height - 32}"
Application.application 在 4.0 中已弃用。所以我将其替换为
width="{FlexGlobals.topLevelApplication.width - 24}"
height="{FlexGlobals.topLevelApplication.height - 32}"
现在编译器给出警告,无法检测到 topLevelApplication 的数据绑定。
数据绑定将无法 检测分配给 “顶级应用程序”
我的问题是:是否有另一个(可绑定)属性可以用来获得与以前相同的功能?
I am migrating an application from Flex 3 to Flex 4.
In some cases there are popup windows of which the width and height is bound to the application width and height.
width="{Application.application.width - 24}"
height="{Application.application.height - 32}"
Application.application is deprecated in 4.0. so I have replaced this with
width="{FlexGlobals.topLevelApplication.width - 24}"
height="{FlexGlobals.topLevelApplication.height - 32}"
Now the compiler gives the warning that data bindings cannot be detected for topLevelApplication.
Data binding will not be able to
detect assignments to
"topLevelApplication"
My question is: Is there another (bindable) property somewhere that I can use to get the same functionality as before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
只需创建一个对象类型的变量并使其可绑定:
然后使用该变量。
Just create a variable of type object and make it bindable :
And then use the variable.
如果您使用
{this.screen.height}
,您的警告就会消失。蒂姆
If you use
{this.screen.height}
your warnings should go away.Tim
这应该适用于强制转换:
它不适用于当前代码的原因是因为 FlexGlobals.topLevelApplication 被键入为对象。
This should work with a cast:
The reason why it isn't working with your current code is because FlexGlobals.topLevelApplication is typed as an Object.
我被卡住了半个小时,发现
Bindable
只能与大写的“B”一起使用,我做到了,它解决了我的问题。因此,只需编写
Bindable
,而不是bindable,因为引用的类是bindable.Bindable
。I was stuck for half an hour and found out that
Bindable
only works with a capital 'B', I did it and it solved my problem.So, instead of bindable just write
Bindable
as the referred class isbindable.Bindable
.我正在努力解决类似的警告,但我使用的是 VBox,而不是对象问题(通过 [Bindable] 前缀解决)。我需要根据我的 vbox 有多少个孩子来更改图像的来源。所以解决这个问题的办法就是只使用“this”哈哈。这是一个示例:
如果您不使用“this”,IDE 将显示一条警告,类似于该对象的警告。我希望它能帮助其他人!
此致
i was struggling with a similar warning, but instead of an object problem (wich is solved with the [Bindable] prefix) i was using a VBox. I needed to change the source of an image depending on how many childs my vbox has. So the solution to this is only using "this" lol. here's an example:
If you dont use "this" the IDE will show you a warning similar to the one that you have with the object. I hope it helps others!
Best Regards
创建您的应用程序的可绑定变量类型,即 myApp,以获取 myApp 中定义的所有变量或代码补全:
然后使用该变量。
Create a bindable variable type of your application i.e myApp to obtain all the variable defined in myApp or code completion:
And then use the variable.