Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

2 Comments

  1. 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 {

    }

    }

  2. 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 {

    }

    }

Comments are closed.