Questions about Array in AS2

Hello everyone,

I have a question regarding how to create arrays with the same name inside an array of object. When I populate the array with data from a xml file, all of them got the same value. Below are the codes I wrote.


AdBoard.as

class AdBoard {
private var xPos:Number;
private var yPos:Number;
private var boardHeight:Number;
private var adsID:String;
private var imagePath:String;
private var url:String;

public function AdBoard(adNode:XML) {
	this.loadData(adNode);
	
	//this.displayProperties();
}

public function loadData(adNode:XML) {
	this.setAdsID(adNode);
	this.setBoardHeight(adNode);
	this.setImagePath(adNode);
	this.setLink(adNode);
}

public function setAdsID(adNode:XML) {
	this.adsID = adNode.attributes.id;
}

public function setBoardHeight(adNode:XML) {
	this.boardHeight = adNode.attributes.height;
}

public function setImagePath(adNode:XML) {
	this.imagePath = adNode.attributes.image;
}

public function setLink(adNode:XML) {
	this.url = adNode.attributes.url;
}

public function setXPos(xp:Number) {
	this.xPos = xp;
}

public function setYPos(yp:Number) {
	this.yPos = yp;
}

public function getAdsID():String {
	return this.adsID;
}

public function getBoardHeight():Number {
	return this.boardHeight;
}

public function getImagePath():String {
	return this.imagePath;
}

public function getLink():String {
	return this.url;
}

public function getXPos():Number {
	return this.xPos;
}

public function getYPos():Number {
	return this.yPos;
}

public function displayProperties() {
	trace("==================================");
	trace("Ads ID: " + this.getAdsID());
	trace("Board Height: " + this.getBoardHeight());
	//trace("Origin: (" + this.getXPos() + ", " + this.getYPos() + ")");
	trace("Image path: " + this.getImagePath());
	trace("URL: " + this.getLink());
}

/*
public function display() {
	trace("ad board display function");
}

public function run() {
	trace("ad board run function");
}
*/

}


AdsPanel.as

class AdsPanel {
private var id:Number;
private var xPos:Number;
private var yPos:Number;
private var displayTime:Number;
private var noOfAdBoards:Number;
private var margin:Number;
private var adBoards:Array = new Array();

public function AdsPanel(panelNode:XML) {
	this.loadData(panelNode);
	this.populatePanel(panelNode);
	this.setPositions(this.xPos, this.yPos, this.adBoards);

	//this.displayProperties();
}

public function loadData(panelNode:XML) {
	this.setID(panelNode);
	this.setXPos(panelNode);
	this.setYPos(panelNode);
	this.setDisplayTime(panelNode);
	this.setMargin(panelNode);
	this.setNoOfAdBoards(panelNode);
}

public function populatePanel(panelNode:XML) {
	for(var i = 0; i < this.getNoOfAdBoards(); i++) {
		this.adBoards* = new AdBoard(panelNode.childNodes*);
		//trace(this.adBoards*.getBoardHeight());
	}
}

public function setPositions(x_ori:Number, y_ori:Number, boards:Array) {
	boards[0].setXPos(x_ori);
	boards[0].setYPos(y_ori);
	for(var i = 1; i < boards.length; i++) {
		boards*.setXPos(x_ori);
		boards*.setYPos(Number(boards[i-1].getYPos()) + Number(boards[i-1].boardHeight) + Number(this.margin));
	}
}

public function setID(panelNode:XML) {
	this.id = panelNode.attributes.id;
}

public function setXPos(panelNode:XML) {
	this.xPos = panelNode.attributes.x_pos;
}

public function setYPos(panelNode:XML) {
	this.yPos = panelNode.attributes.y_pos;
}

public function setDisplayTime(panelNode:XML) {
	this.displayTime = panelNode.attributes.displaytime;
}

public function setNoOfAdBoards(panelNode:XML) {
	this.noOfAdBoards = panelNode.childNodes.length;
}

public function setMargin(panelNode:XML) {
	this.margin = panelNode.attributes.margin;
}

public function getID():Number {
	return this.id;
}

public function getXPos():Number {
	return this.xPos;
}

public function getYPos():Number {
	return this.yPos;
}

public function getDisplayTime():Number {
	return this.displayTime;
}

public function getMargin():Number {
	return this.margin;
}

public function getNoOfAdBoards():Number {
	return this.noOfAdBoards;
}

public function displayProperties() {
	trace("/////////////////////////////");
	trace("Panel ID: " + this.getID());
	trace("Origin: (" + this.getXPos() + ", " + this.getYPos() + ")");
	trace("Display time: " + this.getDisplayTime());
	trace("Margin: " + this.getMargin());
	trace("No. of Ads: " + this.getNoOfAdBoards());
	this.displayAdsBoardsProperties();
}

public function displayAdsBoardsProperties() {
	for(var i = 0; i < this.getNoOfAdBoards(); i++) {
		trace("Ad Boards " + i + ": (" + this.adBoards*.getXPos() + ", " + this.adBoards*.getYPos() + ")");
		trace("Ad Boards Height: " + this.adBoards*.getBoardHeight());
	}
}

}


AdsWindow.as

class AdsWindow {
private var panels:Array = new Array();
private var panelNo:Number;
private var currentPanel:Number;

public function AdsWindow(xmlNode:XML) {
	this.setPanelNo(xmlNode);
	this.populatePanels(xmlNode);
	this.setCurrentPanel(0);
	
	this.resizeButtons(this.currentPanel);
	this.displayProperties();
}

public function populatePanels(xmlNode:XML) {
	for(var i = 0; i < this.getPanelNo(); i++) {
		//trace(xmlNode.childNodes*);
		this.panels* = new AdsPanel(xmlNode.childNodes*);
	}
}

public function resizeButtons(curPanel:Number) {
	for(var i = 0; i < this.panels[curPanel].getNoOfAdBoards(); i++) {
		//trace(this.panels[curPanel].adBoards*.getBoardHeight());
	}

	_root.inviBtn00._x = this.panels[curPanel].adBoards[0].getXPos();
	_root.inviBtn00._y = this.panels[curPanel].adBoards[0].getYPos();
	_root.inviBtn00._height = this.panels[curPanel].adBoards[0].getBoardHeight();
	
	_root.inviBtn01._x = this.panels[curPanel].adBoards[1].getXPos();
	_root.inviBtn01._y = this.panels[curPanel].adBoards[1].getYPos();
	_root.inviBtn01._height = this.panels[curPanel].adBoards[1].getBoardHeight();
}

public function setCurrentPanel(curPanel:Number) {
	this.currentPanel = curPanel;
}

public function setPanelNo(xmlNode:XML) {
	this.panelNo = xmlNode.childNodes.length;
}

public function getCurrentPanel():Number {
	return this.currentPanel;
}

public function getPanelNo():Number {
	return this.panelNo;
}

public function displayProperties() {
	trace("++++++++++++++++++++++++++++++++++++++");
	trace("No of Panels: " + this.getPanelNo());
	for(var i = 0; i < this.getPanelNo(); i++) {
		this.panels*.displayProperties();
	}
}

}

ads_data.xml

<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?>
<ads_panel id=“1” x_pos=“30” y_pos=“30” displaytime=“5” margin=“20”>
<ad id=“ADV000001” height=“120” image="./images/01.png" url="./pages/01.html"></ad>
<ad id=“ADV000002” height=“120” image="./images/02.png" url="./pages/02.html"></ad>
<ad id=“ADV000003” height=“120” image="./images/03.png" url="./pages/03.html"></ad>
<ad id=“ADV000004” height=“120” image="./images/04.png" url="./pages/04.html"></ad>
<ad id=“ADV000005” height=“120” image="./images/05.png" url="./pages/05.html"></ad>
<ad id=“ADV000006” height=“120” image="./images/06.png" url="./pages/06.html"></ad>
</ads_panel>
<ads_panel id=“2” x_pos=“30” y_pos=“30” displaytime=“10” margin=“20”>
<ad id=“ADV000001” height=“100” image="./images/01.png" url="./pages/01.html"></ad>
<ad id=“ADV000002” height=“60” image="./images/02.png" url="./pages/02.html"></ad>
<ad id=“ADV000003” height=“120” image="./images/03.png" url="./pages/03.html"></ad>
<ad id=“ADV000004” height=“60” image="./images/04.png" url="./pages/04.html"></ad>
<ad id=“ADV000005” height=“120” image="./images/05.png" url="./pages/05.html"></ad>
<ad id=“ADV000006” height=“120” image="./images/06.png" url="./pages/06.html"></ad>
</ads_panel>
</data>


Flash fla file - code on the first frame of the movie

stop();

var adsDataFile:String = “./ads_data.xml”;
var adsWin:AdsWindow;

var adsLifeTime:Number = 5;
var _delay:Boolean = true;
var lastTime:Number = 0;
var adsProxies:Array = [];

var adsXMLdata=new XML();
adsXMLdata.ignoreWhite = true;

adsXMLdata.onLoad = function(success){
if (success){
adsWin = new AdsWindow(adsXMLdata);
}
}
adsXMLdata.load(adsDataFile);

If you put these together and test run the project, you can see that the two arrays of adsBoard have exactly the same data. This really confuses me. I would really appreciate if anyone could help me with what caused this weird thing and how to solve it.

Thank you very much in advance.

Best Regards,
Frank