如何修复 mx:request 标记中的此警告?
我正在使用以下请求运行 HTTPService:
<mx:request xmlns="">
<view>{myViewStack.selectedChild.name}</view>
</mx:request>
想法是将视图堆栈上选择的子级传递到 php 页面,然后将其返回,以便我可以根据在视图堆栈中选择的子级运行一些逻辑时间。
一切似乎都正常,但我收到以下警告:
数据绑定将无法检测对“name”的分配。
这似乎不会造成任何麻烦,但我知道警告通常意味着我没有遵循最佳实践。我该如何解决这个问题?我真的不需要绑定这个项目,因为名称在运行时永远不会改变,但我不知道如何将它包含在请求中。
Wouter 给了我一个很好的解决方法。但是有什么方法可以在这样的请求中调用变量而无需绑定吗?
I'm running an HTTPService with the following request:
<mx:request xmlns="">
<view>{myViewStack.selectedChild.name}</view>
</mx:request>
The idea being to pass which child is selected on the viewstack to the php page, and then get that back so I can run some logic based on which child of the viewstack was selected at the time.
Everything seems to work, but I get the following warning:
Data binding will not be able to detect assignments to "name".
This doesn't seem to be causing any trouble, but I know warnings usually mean that I am not following the best practice. How can I fix this? I don't really need this item to be bound, because the name will never change at runtime, but I don't know how else to include it in the request.
Wouter's given me a good workaround. But is there any way to call a variable in a request like this without binding?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法告诉 Flex 您对
name
的更改不感兴趣,也无法标记要忽略的警告。作为解决方法,您可以将名称的获取提取到单独的函数中。像这样的事情:
There is no way to tell Flex that you're not interested in changes to
name
, and no way to flag a warning to be ignored.As a workaround, you can extract the getting of the name into a separate function. Something like this: