Flex 中是否可以从子组件调用父组件中的函数?

发布于 2024-09-11 12:01:04 字数 121 浏览 2 评论 0原文

我需要调用位于父组件中的函数,并从 Flex 3 中的子组件进行调用。有没有办法从子组件访问父组件中的函数?我知道我可以在子级中调度一个事件并在父级中添加一个侦听器来调用该函数,但只是想知道是否也可以直接从子级调用父级函数。谢谢

I need to call a function located in the parent component and make the call from the child component in Flex 3. Is there a way to access functions in the parent component from the child component? I know I can dispatch an event in the child and add a listener in the parent to call the function, but just wanted to know if could also directly call a parent function from a child. Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

握住我的手 2024-09-18 12:01:04

您可以使用parentApplication ...如果我有一个调用组件的main.mxml,我们将调用child.mxml,我可以通过执行以下操作从子组件中调用main中的函数:

例如,

parentApplication.parentsFunctionName(parameters);

You can use parentApplication

For example... if i have a main.mxml that calls a component we'll call child.mxml, i can call functions in main from within child by doing the following:

parentApplication.parentsFunctionName(parameters);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文