'Create an XML file from a script AS3

I can not figure out how I get more XML file from the language images,

In the image here you will look at setupItems how it is built

Here it explains how I build the missing XML file but I do not understand how I build it properly that will work for me on the site

public function init(param1:int) : void
  {
     var _loc2_:String = null;
     this.itemHolder.addChild(this.hairHolder);
     this.itemHolder.addChild(this.shirtHolder);
     this.shirtHolder.visible = false;
     this.itemHolder.addChild(this.pantsHolder);
     this.pantsHolder.visible = false;
     this.itemHolder.addChild(this.shoesHolder);
     this.shoesHolder.visible = false;
     this.activeHolder = this.hairHolder;
     this.initButtons();
     this.randomTimer = new Timer(this.randomTimerInitDelay,this.randomTimerCount);
     this.randomTimer.addEventListener(TimerEvent.TIMER,this.changeRandomClothes,false,0,true);
     this.xml = new XML();
     if(param1 == 1)
     {
        _loc2_ = "boyItems.xml";
     }
     else if(param1 == 2)
     {
        _loc2_ = "girlItems.xml";
     }
     this.xmlLoader = new URLLoader(new URLRequest("./website/common/register/xmls/" + _loc2_));
     this.xmlLoader.addEventListener(Event.COMPLETE,this.xmlLoaded);
     this.xmlLoader.addEventListener(IOErrorEvent.IO_ERROR,this.errorLoadingXml);
  }

another code

private function xmlLoaded(param1:Event) : void
  {
     this.xmlLoader.removeEventListener(Event.COMPLETE,this.xmlLoaded);
     this.xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR,this.errorLoadingXml);
     this.xml = XML(this.xmlLoader.data);
     Register.AVATAR_HAIR = this.xml.hair.child(0).@id;
     var _loc2_:int = Math.random() * 2 + 1;
     this.bubble.gotoAndStop("hair_" + Register.language + _loc2_);
     this.setupItems(this.xml.hair,this.hairItems,this.hairHolder);
     this.setupItems(this.xml.shirt,this.shirtItems,this.shirtHolder);
     this.setupItems(this.xml.pants,this.pantsItems,this.pantsHolder);
     this.setupItems(this.xml.shoes,this.shoesItems,this.shoesHolder);}

  
  private function setupItems(param1:*, param2:Array, param3:Sprite) : void
  {
     var _loc9_:* = undefined;
     var _loc10_:Item = null;
     var _loc4_:int = 54.5;
     var _loc5_:Number = 64.5;
     var _loc6_:*;
     var _loc7_:int = (_loc6_ = param1).children().length();
     var _loc8_:int = 0;
     while(_loc8_ < _loc7_)
     {
        _loc9_ = _loc6_.child(_loc8_);
        (_loc10_ = new Item()).x = _loc4_;
        _loc4_ += this.itemSpacing;
        _loc10_.y = _loc5_;
        _loc10_.loadItem(_loc9_.@type,_loc9_.@ordinal,_loc9_.@id,_loc9_.@inventoryType,Register.pathToItemsFolder);
        param2.push(_loc10_);
        param3.addChild(_loc10_);
        _loc8_++;
     }
  }

This is the loadItem file:
(Maybe here you can see how I build the XML files)

public function loadItem(param1:int, param2:int, param3:int, param4:int, param5:String) : void
  {
     this.type = param1;
     this.ordinal = param2;
     this.id = param3;
     this.itemImage = new ImageItemNoCache(param1,param2,param3,param4,null,null,param5);
     this.itemImage.mouseEnabled = false;
     this.itemImage.mouseChildren = false;
     this.itemImage.addEventListener(ImageItem.DATA_LOADED,this.positionImage,false,0,true);
     addChild(this.itemImage);
     addEventListener(MouseEvent.CLICK,this.clickedMe,false,0,true);
  }

Code for ImageItemNoCache:

public class ImageItemNoCache extends ImageItem
{
    private var textData:Object;

    private var itemData:Object;

    private var pathToItemsFolder:String;

    public function ImageItemNoCache(param1:int, param2:int, param3:int, param4:int, param5:Object = null, param6:Object = null, param7:String = ".")
    {
        this.textData = param5;
        this.itemData = param6;
        this.pathToItemsFolder = param7;
        super(param1,param2,param3,param4);
    }

    override protected function getImageItemData(param1:int, param2:int = -1, param3:int = -1, param4:int = -1) : ImageItemData
    {
        return new ImageItemDataNoCache(param1,param2,param3,param4,this.textData,this.itemData,this.pathToItemsFolder);
    }

    override public function clone() : DisplayItem
    {
        return new ImageItemNoCache(getType(),getOrdinal(),getId(),getInventoryType(),this.textData,this.itemData,this.pathToItemsFolder);
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source