Hi all, I have bought a dynamic xml loaded menu from a flash stock website. I am having trouble spacing the buttons as its totally controlled in AS2. I emailed him and no reply yet, as this is urgent, im posting my problem on the forums, hopefully someone will help me.
The code is as follows:
// List of the buttons
var itemList = []
// The xml data
var xmlSource:XML = new XML
// Loading the xml
xmlSource.onLoad = function(success:Boolean):Void {
// When the load finishs...
if (success) {
// Settings
xmlSettings = xmlSource.firstChild
// The first node of the xml
xmlRoot = xmlSource.childNodes[1]
// The item nodes
xmlItems = xmlRoot.childNodes
// The total of items
total = xmlItems.length
// Creating the buttons
for (i=0; i<total; i++){
// Attachs thee buttos
holder.attachMovie("button", "button" + i, i)
// Inserts the button in the array
itemList* = holder["button" + i]
// Puts the text
itemList*.txt.text = itemList*.txtColor.text = itemList*.ref.mcReflect.txt.text = itemList*.ref.mcReflect.txtColor.text = xmlItems*.attributes.name
// Resizes the textbox
itemList*.txt.autoSize = true
// Centers the text
itemList*.txt._y = itemList*.txtColor._y = -itemList*.txt._height/2
// Resizes the color text
itemList*.txtColor.autoSize = true
// Resizes the area
itemList*.area._width = itemList*.txt._width
// Resizes the mask
itemList*.ref.mask._width = itemList*.area._width
// Resizes the area
itemList*.area._height = itemList*.ref.mask._height = itemList*.txt._height
// Centers the area
itemList*.area._y = itemList*.txt._y
// Centers the area
itemList*.area._x = itemList*.txt._x
// Positionates the reflect
itemList*.ref._y = 0
// Hides the color
itemList*.txtColor._alpha = 0
// Sets the color
itemList*.txtColor.textColor = itemList*.ref.mcReflect.txtColor.textColor = "0x"+xmlItems*.attributes.color
// Resizes the reflection text
itemList*.ref.mcReflect.txt.autoSize = true
// Resizes the reflection text color
itemList*.ref.mcReflect.txtColor.autoSize = true
// Links
itemList*.link = xmlItems*.attributes.link
// Scale
itemList*.maxScale = xmlSettings.childNodes[1].firstChild.nodeValue
// Centered
centered = xmlSettings.firstChild.firstChild.nodeValue
// Menu Width
menuWidth = holder._width
// Starts centering the menu
Start = true
}
}
}
// ignore white
xmlSource.ignoreWhite = true;
// Loads the .xml file
xmlSource.load("source.xml");
holder.onEnterFrame=function(){
// Centers the text
if (centered){
//holder._x += ((menuWidth -holder._width/2 + menuWidth) - holder._x)/3
// Aligns to the left
} else {
holder._x += (0-holder._x)/3
}
// Starts centering
if (Start){
// Does this to all the buttons
for (i=1; i<=total; i++){
// Makes it button be below the other
itemList*._x = itemList[i-1]._x + itemList[i-1]._width
}
}
}
I have played with the numbers in this part of the code and discovered that this is the section where it is controlling the spacing between each button
holder.onEnterFrame=function(){
// Centers the text
if (centered){
//holder._x += ((menuWidth -holder._width/2 + menuWidth) - holder._x)/3
// Aligns to the left
} else {
holder._x += (0-holder._x)/3
}
// Starts centering
if (Start){
// Does this to all the buttons
for (i=1; i<=total; i++){
// Makes it button be below the other
itemList*._x = itemList[i-1]._x + itemList[i-1]._width
}
}
}
What I want to do is make the space between the buttons bigger.
Cheers
Goldfish