使用 flashvar 将请求文件传递到 Flex 应用程序

发布于 2024-12-09 00:37:41 字数 605 浏览 3 评论 0原文

我正在尝试将包含数据的 xml 文件放入 Flex 应用程序中。我发现网上有很多将参数传递到 Flex 的示例非常有帮助。然而,它在我的情况下并没有真正起作用。

这是我的 HTML 代码:

var flashvars = {};
flashvars.storageStatsXML = "stats.xml";
var params = {};
swfobject.embedSWF("mySWF.swf", "mySWF", "1000", "500", "10.0.0", "js/expressInstall.swf", flashvars, params);

这是 mxml 中的代码:

[Bindable]
public var storageStats:XML;

protected function start(event:FlexEvent):void
{
    storageStats = Application.application.parameters.storageStatsXML;
}

然后在应用程序中解析 XML 文件。

我认为代码有一些不正确的地方,有什么想法吗?

谢谢。

I am trying to get a xml file with data into Flex application. There are a lot of examples online passing parameter into flex I found very helpful. However, it doesn't really work in my case.

here is my code in HTML:

var flashvars = {};
flashvars.storageStatsXML = "stats.xml";
var params = {};
swfobject.embedSWF("mySWF.swf", "mySWF", "1000", "500", "10.0.0", "js/expressInstall.swf", flashvars, params);

here is the code in mxml:

[Bindable]
public var storageStats:XML;

protected function start(event:FlexEvent):void
{
    storageStats = Application.application.parameters.storageStatsXML;
}

And then the XML file got parsed in the application.

I think there is something not right about the code, any thoughts?

Thanks.

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

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

发布评论

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

评论(1

上课铃就是安魂曲 2024-12-16 00:37:41

Application.application.parameters.storageStatsXML 属性不是您期望的 XML 数据,它是一个包含文本 "stats.xml"String >。

就像文件路径“c:\temp\info.txt”(或“/temp/info.txt”)不是文件本身一样,它只是告诉您如何在磁盘上查找该文件。

您需要使用 URLRequest加载由 storageStatsXML 属性指定的 XML 文件。

查看 Actionscript 文档和 StackOverflow 上的示例,了解如何加载外部数据。

The Application.application.parameters.storageStatsXML property is not the XML data you are expecting, it is a String containing the text "stats.xml".

In the same way that the file path "c:\temp\info.txt" (or "/temp/info.txt") isn't the file itself, it just tells you how to find the file on disk.

You will need to use a URLRequest to load the XML file specified by the storageStatsXML property.

Have a look at the Actionscript documentation and here on StackOverflow for examples on how to load external data.

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