如何将参数从组件发送到主 MXML 应用程序

发布于 2024-11-28 14:37:06 字数 247 浏览 2 评论 0原文

我想将变量或参数从组件发送到主(MXML)应用程序。就像我的组件是 FileUpload.mxml 一样,希望将上传的文件详细信息从 FileUpload.mxml 转发到 Main.mxml。

我尝试了以下过程:

com:FileUpload id="fp"

来获取 FileUpload 组件的引用,但是,我无法从 FileUpload.mxml 文件中获取变量。

谁能帮我解决这个问题?

宁静

I would like to send variables or parameters from Component to Main (MXML) Application. Like my component is FileUpload.mxml and would like to forward the uploaded file details from FileUpload.mxml to Main.mxml.

I tried the following procedure :

com:FileUpload id="fp"

to get the reference for the FileUpload component, however, I am unable to get the variables from the FileUpload.mxml file.

Can anyone help me to fix this issue ?

Serenity

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

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

发布评论

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

评论(1

〃温暖了心ぐ 2024-12-05 14:37:06

根据您所处的开发阶段,您可能需要考虑一种肯定能帮助解决此类情况的 Flex 框架。我个人使用 Mate,但还有其他几个选项欧芹Cairngorm, RobotLegs 等)。

使用 Mate,您可以创建一个自定义事件,该事件将在发生某些事情(例如上传文件)后调度。此自定义事件可以包含您想要传递给另一个组件的任何附加信息、属性或数据。然后,您可以将事件侦听器添加到您的自定义事件的主地图中。主地图将捕获您的自定义事件并重新路由到它需要前往的任何组件。

如果这不是一个选项,请确保您要访问的属性 a) 标记为 [Bindable] 和 b) public。如果没有看到一些代码,很难说什么是最好的解决方案。

Depending on what stage of development you're in you may want to consider one of the Flex frameworks out there that would definitely help with this type of situation. I personally use Mate, but there are several other options out there Parsley, Cairngorm, RobotLegs, etc.).

With Mate, you would create a custom event that would get dispatched after something happens (a file being uploaded for example). This custom event could include any additional information, properties or data you would like to pass to another component. You would then add an event listener to your main map for your custom event. The main map would capture your custom event and re-route to whichever component(s) it needed to go to.

If that's not an option, make sure the properties you want to access are a) marked as [Bindable] and b) public. It's hard to say what could be the best solution without seeing some code.

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