开发者

Passing request file into flex application with flashvar

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.开发者_如何学Python

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜