ActionScript 2.0 XML file path

Posted on 2009-02-17
Last Modified: 2013-11-11
I am pretty new to ActionScript, and have done some coding in the past in .asp \ .aspx, but it is not my primary forte.  I am working on a site that has a page for project photo galleries, using a lot of the examples from  I have a directory structure as follows:

root folder (containing projects.swf)
      |-->project1 (containing image files, thumbnail images, and images.xml)

I am looking for advice on how to code projects.fla and resulting projects.swf so that when a button within this file is pressed, a variable containing the path to the .xml file and image files for a particular project is passed to the .swf file.  All of the examples I have seen to this point have the .xml file and the image files in the same directory as the .swf.  Or other suggestions?  I am working with AS 2.0, using Flash MX 2004.  Thanks in advance for any \ all advice you can pass along.
Question by:rdillion
    LVL 12

    Accepted Solution

    just change the file name from "images.xml" to "projects/project1/images.xml"

    sample here...
    xmlImages:XML = new XML();
    xmlImages.ignoreWhite = true;
    xmlImages.onLoad = function(ok){
        trace("loaded fine: " + this)
        trace("problem loading")
    //trigger the loading of the data

    Open in new window


    Author Comment

    Thanks for the advice scooby_56,
    I have tried changing the path to the .xml file, addiing full paths to the images in the .xml file, etc. with varying results.  What I am really looking for is advice on the recommended way to code a .swf file so that a variable can be passed to it that contains the path to an .xml file in another directory, and load the .xml file so that it can find and open the images in the same directory as the .xml file.  I also need some help in exaclty how to pass the variable to the .swf as I am quite new to AS.


    Author Comment

    After continuing with modifying paths, I have been able to make the site work as desired.  I would still like to find information on how to pass the path to a single .swf, instead of maintaining individual .swf files for each of the folders I would like to display a gallery for, but will continue efforts on that later.  Thanks again scooby_56 for taking a look.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now