FRAME 1 ActionScript
==================
// Import Global variables
import AAPglobal;
// Create variables
var loader:URLLoader = new URLLoader(); // Used to load the AAP Project information
var AAPxml:XML; // AAP Project Information
var AbstractList:XMLList; // List of Abstracts from AAP Project Information
var banner:String; // JPG file name for banner
//load the XML
loader.addEventListener(Event.COMPLETE, onceLoaded);
function onceLoaded(event:Event):void
{
AAPxml = new XML(event.target.data);
AAPxml.ignoreWhitespace = true; //don't consider whitespace as nodes
banner = AAPxml.banner.image; //get banner image file name
AAPglobal.disclosureFile = AAPxml.disclosure.text; //get disclosure statement file name
trace(AAPglobal.disclosureFile);
trace(AAPxml.disclosure.text);
AAPglobal.faqsFile = AAPxml.faqs.text; //get FAQs file name
AAPglobal.contactUsFile = AAPxml.contactus.text; //get contact us file name
AbstractList = AAPxml.abstracts;
// Load the banner
var bannerLoader:Loader = new Loader(); // define the loader
var fileRequest:URLRequest = new URLRequest(banner); // define the requester
// Set up event listeners to check on load progress and to process image when load is complete
bannerLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onbannerLoaderProgress);
bannerLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onbannerLoaderComplete);
bannerLoader.load(fileRequest);
function onbannerLoaderProgress(e:ProgressEvent):void
{
// this is where progress will be monitored
trace(e.bytesLoaded, e.bytesTotal);
}
function onbannerLoaderComplete(e:Event):void
{
// the image is now loaded, add it to display tree
var loader:LoaderInfo = LoaderInfo(e.target);
var loadedImg;
loadedImg = loader.content;
loadedImg.x=0;
loadedImg.y=0;
addChild(loadedImg);
}
}
loader.load(new URLRequest("AAP.xml"));
FRAME 2 ActionScript
===================
// Import Global variables
import AAPglobal;
trace(AAPglobal.disclosureFile);
stop();
AAPglobal.as (resides in same folder as .fla file)
============
// AAP Global Variables
package
{
public class AAPglobal
{
public static var disclosureFile:String;
public static var faqsFile:String;
public static var contactUsFile:String;
}
}
|