如何在flex中操纵子控件
我正在尝试操作(上下移动、启用/禁用和启动表单)面板控件内的子控件。但是我无法获取发生单击事件的子控件的 id。
为了说明这一点,我正在尝试创建类似的可用功能。我正在尝试创建您在图像中看到的上下按钮 http://i34.tinypic .com/2gugio6.jpg
任何帮助/指针表示赞赏。
谢谢
I am trying to manipulate (move up and down, enable/disable and launch a form) child controls inside a panel control. However I am unable to get the id of the child control on which the click event occurs.
To illustrate, I am trying to create similar functionality as is available. I am trying to create the up-down buttons that you see in the image at http://i34.tinypic.com/2gugio6.jpg
Any help/pointers are appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在事件处理程序中使用 event.currentTarget 来访问发生事件的子控件。
Use
event.currentTarget
inside the event handler to access the child control in which the event occurred.如果您发布一些代码将会有所帮助。由于我不知道细节,所以我给你最基本的答案。
例如,如果您想要代码中某个按钮的 id,则可以在 mxml 中指定该 id。所以,
现在,假设在你的脚本中你想在此处添加一个事件侦听器,你可以像
现在一样访问它,假设你不想访问按钮或一些独立的控件,但你想访问列表中的元素,有几个方式。我假设您想要访问所选项目。您只需说
正如我所说,如果您发布代码并指定更精确的问题,将会有所帮助。
It would help if you post some code. Since I don't know the details, I am giving you the most basic answer.
For example, if you want id of a button in your code, you specify that id in the mxml. So,
Now, say in your script you want to add an event listener here, you access this as
Now, lets say you want to access not a button or some independent control, but you want to access elements inside a list, there are several ways. I am presuming you would like to access the selected item. You simply say
As I said, it would help if you post your code and specify a more precise problem.