Adobe Flex 引用另一个对象
我有一个 Flex 3 数据网格,它位于与我尝试从中引用它的对象完全独立的容器中 - 即数据网格位于 vbox 中,并且我试图从弹出窗口中设置数据网格中的属性。
如何从弹出窗口访问数据网格? 我想做一些类似的事情:
myView.myDatagrid.resizableColumns = false;
使用 cairngorm 作为框架(如果有任何帮助的话)。
I have a flex 3 datagrid that is in a completely separate container from the object that I am trying to reference it from - i.e. the datagrid is in a vbox, and I am trying to set a property in the datagrid from a popup.
How do I access the datagrid from the popup?
I'd like to do something like:
myView.myDatagrid.resizableColumns = false;
Using cairngorm as a framework if that is of any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须更好地解释您的架构才能获得具体答案。 这个答案可能会有所帮助,因为我所说的关于跑步的一切另一个组件上的方法也适用于访问属性。
一种解决方案是将 DataGrid 实例作为实例变量传递到弹出窗口中;那么 PopUp 将能够轻松更改 DataGrid 的属性。
You'll have to explain your architecture better to get a specific answer. This answer may help as everything I said about running methods on another component, also applies to accessing properties.
One solution for you is to pass the DataGrid instance into the popup as an instance variable; then the PopUp will be able to change the DataGrid's properties easy.
添加弹出窗口时,您需要侦听事件。然后你的 PopUp 需要调度一个父级可以处理的事件。
然后在父组件中
假设有一个名为 SomeEvent 的自定义事件...您实际上可以创建一个默认的 Flash 事件并为其命名,例如
假设您的弹出窗口中有一个按钮:
When you add your popup, you need to listen for an event. Then your PopUp needs to dispatch an event that the parent can handle.
and then in the parent component
This assumes a custom event called SomeEvent... you can actually just create a default Flash event and give it a name like
Assuming you've got a button in your popup: