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);
}
I usually do this kind of thing with a flashvar parameter in the embed code.
so.addParam('flashvars','xmlPath=xml/exampleData.xml');
And then you'll need a line like this in your Actionscript...
private var xmlPath:string;
xmlPath = root.loaderInfo.parameters.xmlPath;
精彩评论