参数 url 必须非空
我在尝试将 XML 文件的路径传递到 Shockwave flash 对象时收到 Parameter url must be non-null
错误。
javascript 代码如下
<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addVariable("xmlPath", "xml/exampleData.xml");
so.write("flashcontent");
</script>
如您所见,我尝试在 SWF 文件中加载的 XML 文件是 exampleData.xml
在 ActionScript 中,我声明了变量 xmlPath,如下所示
public var xmlPath:String
...加载事件我做了适当的更改
private function loadComp(data:String):void
{
xmlModel.xml = new XML(data);
new LoadXml(xmlPath, picHandler);
}
,问题来了。
我在这里做错了什么? 为什么我会收到 Parameter url must be non-null
错误?
PS 如果我在动作脚本文件中硬编码路径,一切都会很好!
private function loadComp(data:String):void
{
xmlModel.xml = new XML(data);
new LoadXml('xml/exampleData', picHandler);
}
i am getting the Parameter url must be non-null
error while trying to pass the path of an XML file to an Shockwave flash object.
The javascript code is as follows
<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addVariable("xmlPath", "xml/exampleData.xml");
so.write("flashcontent");
</script>
As you can see the XML file i am trying to load within the SWF file is the exampleData.xml
Within the ActionScript i declared the variable xmlPath as follows...
public var xmlPath:String
and in the load event i made the appropriate changes
private function loadComp(data:String):void
{
xmlModel.xml = new XML(data);
new LoadXml(xmlPath, picHandler);
}
And here comes the question.
What am i doing wrong here?
Why do i get the Parameter url must be non-null
error?
P.S. If i hard-code the path, within the actionscript file, everything works great!
private function loadComp(data:String):void
{
xmlModel.xml = new XML(data);
new LoadXml('xml/exampleData', picHandler);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常在嵌入代码中使用 flashvar 参数来执行此类操作。
然后你的 Actionscript 中需要这样一行......
I usually do this kind of thing with a flashvar parameter in the embed code.
And then you'll need a line like this in your Actionscript...