A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Calling an XML file through flashvars

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    1

    Question Calling an XML file through flashvars

    Hi guys,

    I have a flash based animation that calling link items via an external XML file (links.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 links.xml file inside flash is as shown:
    links_xml = new XML();
    links_xml.ignoreWhite = true;
    links_xml.load("links.xml");
    links_xml.onLoad = function(success) {
    .... etc

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

    <script type="text/javascript">
    var so = new SWFObject("site/content/flash/links.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/links.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 and i am using AS2 for this

  2. #2
    Clarance the Clear Boy
    Join Date
    Mar 2012
    Posts
    5
    Here's a useful article with information about using Flashvars in both AS2 and 3:
    http://www.dreamincode.net/forums/to...n-as2-and-as3/

    Since you are using SWFObject, you can ignore the HTML portion and skip down to AS2.
    You will basically be accessing the variable as a property of the _root object, and using that to load the path.

    Hope that works for ya!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center