Below is some dodgy AS, in that its nots working… you can see from the trace that the header variable, does have a value, but it won’t assign to the txtlabel for my textbox. Any ideas anybody.
defX = 0;
defY = 0;// distance _y btw menu items
myformat = new TextFormat();
myformat.color = 0x000000;
myformat.font = "FFF Harmony";
myformat.align="left";
myformat.size=8;
myformat.bold= false;
//***************************************************
// Contruct myButton object
myButton = function () {
this.onLoad = function() {
this.label_txt.embedFonts = true;
this.label_txt.setTextFormat(myformat);
};
this.onRollOver = function() {
this.label_txt.textColor = 0xFF0000;
};
this.onRollOut = function() {
this.label_txt.textColor = 0x000000;
};
this.onRelease = function() {
myString=new String(this._name);
getURL(myString.toLowerCase()+".html");
};
this.txtSet = function(what) {
this.label_txt.text = what;
defX +=(this.label_txt.textWidth + 10);
if (_global.devX < defX) _global.defX = defX;
};
this.posMe = function(xVal, yVal) {
this._x = xVal;
this._y = yVal;
};
}
// register myButton as a movieclip
myButton.prototype = new MovieClip();
//assosiate the object with 'but' in library
Object.registerClass("but", myButton);
//**********************************************
var array = new Array ();
var xml = new XML ();
xml.onLoad = function ()
{
var header, link;
for (var i = 0; i < this.firstChild.childNodes.length; i++)
{
if (this.firstChild.childNodes*.nodeName != null)
{
header = this.firstChild.childNodes*.attributes.header;
}
for (var j = 0; j < this.firstChild.childNodes*.childNodes.length; j++)
{
if (this.firstChild.childNodes*.childNodes[j].nodeName == "link")
{
link = this.firstChild.childNodes*.childNodes[j].firstChild.nodeValue;
}
}
//array.push (new struct (header, link));
this.attachMovie("but", "button"+i, 109+i);
// position menus and set text
this["button"+i].posMe(defX, defY);
this["button"+i].txtSet("chris");
trace("header:"+header+"button:"+"button"+i);
array.push(header);
}
};
xml.load ("dbase.xml");
stop();