I’ll post a proper blog entry on this when I get back from San Francisco, but I wanted to provide a link to the slides from my short introductory talk to my Ask The Experts session on the 5 coolest features of ActionScript 2.0, and what they mean to developers.
Also, for those who attended the session, and are looking for more information on my Flash Development workshop, you can find it here, here and here.
Here is a good option for loading multiple XML file by using this custom .as file
/***************************************************************************************
* Author – Sanjeev Rajput
* Date – 16-July-07
* class is used to load any XML file and dispatch an event when XML is loaded
*****************************************************************************************/
class XMLLoader extends mx.events.EventDispatcher {
//———— variable Declaration —————–
public var isLoaded:Boolean = false;
private var xmlObj:XML;
private var fileRef:String;
private static var ref:Object;
//———- constructor function ———
function XMLLoader() {
trace(‘XMLLoader constructor called’);
this.xmlObj = new XML();
this.xmlObj.ignoreWhite = true;
}
//———- XML load function —————-
public function loadXML(fileRef,param:String) {
this.fileRef = fileRef;
ref = this;
this.xmlObj.onLoad = function(SS:Boolean) {
if (SS) {
//———— dispatch event when loading complete ————–
ref.dispatchEvent({type:”XMLLoaded”, target:this, targetName:param});
} else {
return;
}
};
//————— xml file reference ————————
this.xmlObj.load(this.fileRef);
}
}
>>> how to use this class—–
/***************************************************************************************
* Author – Sanjeev Rajput
* Date – 16-July-07
* Version 1.0
*****************************************************************************************/
class UIController extends mx.events.EventDispatcher {
private static var UI_objRef:Object
private var WareaXML_obj:Object;
private var WareaXML:XML;
private var WareaXMLpath:String = “data/Warea.xml”;
private var GalleryXML_obj:Object;
private var GalleryXML:XML;
private var GalleryXMLpath:String = “data/Gallery.xml”;
private var fontListXML_obj:Object;
private var fontListXML:XML;
private var fontListXMLpath:String = “data/FontList.xml”;
private static var isXMLParse:Boolean = false;
//———- constructor function ———
function UIController(timeLine) {
UI_objRef = this;
this.WareaXML_obj = new XMLLoader();
this.WareaXML_obj.loadXML(this.WareaXMLpath, “WareaXML”);
this.fontListXML_obj = new XMLLoader();
this.fontListXML_obj.loadXML(this.fontListXMLpath, “FontListXML”);
this.GalleryXML_obj = new XMLLoader();
this.GalleryXML_obj.loadXML(this.GalleryXMLpath, “GalleryXML”);
this.GalleryXML_obj.addEventListener(“XMLLoaded”, this.initXMLData);
}
private function initXMLData(evt):Void {
if (evt.targetName == ‘GalleryXML’) {
UI_objRef.GalleryXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initGComboBoxData();
}
if (evt.targetName == ‘WareaXML’) {
UI_objRef.WareaXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initWComboBoxData();
}
if (evt.targetName == ‘FontListXML’) {
UI_objRef.fontListXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initFComboBoxData();
}
}
private function initWComboBoxData():Void {
}
private function initGComboBoxData():Void {
}
private function initFComboBoxData():Void {
}
}
Here is a good option for loading multiple XML file by using this custom .as file
/***************************************************************************************
* Author – Sanjeev Rajput
* Date – 16-July-07
* class is used to load any XML file and dispatch an event when XML is loaded
*****************************************************************************************/
class XMLLoader extends mx.events.EventDispatcher {
//———— variable Declaration —————–
public var isLoaded:Boolean = false;
private var xmlObj:XML;
private var fileRef:String;
private static var ref:Object;
//———- constructor function ———
function XMLLoader() {
trace(‘XMLLoader constructor called’);
this.xmlObj = new XML();
this.xmlObj.ignoreWhite = true;
}
//———- XML load function —————-
public function loadXML(fileRef,param:String) {
this.fileRef = fileRef;
ref = this;
this.xmlObj.onLoad = function(SS:Boolean) {
if (SS) {
//———— dispatch event when loading complete ————–
ref.dispatchEvent({type:”XMLLoaded”, target:this, targetName:param});
} else {
return;
}
};
//————— xml file reference ————————
this.xmlObj.load(this.fileRef);
}
}
>>> how to use this class—–
/***************************************************************************************
* Author – Sanjeev Rajput
* Date – 16-July-07
* Version 1.0
*****************************************************************************************/
class UIController extends mx.events.EventDispatcher {
private static var UI_objRef:Object
private var WareaXML_obj:Object;
private var WareaXML:XML;
private var WareaXMLpath:String = “data/Warea.xml”;
private var GalleryXML_obj:Object;
private var GalleryXML:XML;
private var GalleryXMLpath:String = “data/Gallery.xml”;
private var fontListXML_obj:Object;
private var fontListXML:XML;
private var fontListXMLpath:String = “data/FontList.xml”;
private static var isXMLParse:Boolean = false;
//———- constructor function ———
function UIController(timeLine) {
UI_objRef = this;
this.WareaXML_obj = new XMLLoader();
this.WareaXML_obj.loadXML(this.WareaXMLpath, “WareaXML”);
this.fontListXML_obj = new XMLLoader();
this.fontListXML_obj.loadXML(this.fontListXMLpath, “FontListXML”);
this.GalleryXML_obj = new XMLLoader();
this.GalleryXML_obj.loadXML(this.GalleryXMLpath, “GalleryXML”);
this.GalleryXML_obj.addEventListener(“XMLLoaded”, this.initXMLData);
}
private function initXMLData(evt):Void {
if (evt.targetName == ‘GalleryXML’) {
UI_objRef.GalleryXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initGComboBoxData();
}
if (evt.targetName == ‘WareaXML’) {
UI_objRef.WareaXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initWComboBoxData();
}
if (evt.targetName == ‘FontListXML’) {
UI_objRef.fontListXML = evt.target;
UI_objRef.GalleryXML_obj.removeEventListener();
UI_objRef.initFComboBoxData();
}
}
private function initWComboBoxData():Void {
}
private function initGComboBoxData():Void {
}
private function initFComboBoxData():Void {
}
}