PDA

View Full Version : Calling an XML file through flashvars


Everlongdrummer
08-27-2008, 11:05 AM
Hi guys,

I have a flash based news box that displays news items via an external XML file (news.xml) which works fine. However I have been asked to allow the ability to change the xml location by passing the filename as a variable which can be changed in the html by flashvars.

The code that calls my news.xml file inside flash is as shown:

xmlNews = new XML();
xmlNews.ignoreWhite = true;
xmlNews.onLoad = loadXML;
xmlNews.load("news.xml");

I was planning to change the "news.xml" to a variable and then in the HTML having code such as:

<script type="text/javascript">
var so = new SWFObject("site/content/flash/newsbox.swf", "mymovie", "350", "216", "8", "#E0DBCB");
so.addVariable("variable1", getQueryParamValue("variable1"));
so.addVariable("variable2", getQueryParamValue("variable2"));
so.addParam("FlashVars", "xmlfile=http://www.website.com/location/file.xml");
so.write("flashcontent");
</script>

But this does not work. Does anyone have any suggestions how to get this working? My knowledge of AS does not go that far as to know what AS to change here.

Everlongdrummer
08-27-2008, 11:27 AM
Just a note, I am also using AS2 for this.

gnomeontherun
09-02-2008, 08:35 PM
You should read the SWFObject documentation, but I think making flashvars lowercase is a good start.
Also it is described here.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16417&sliceId=1