Hey,
I have created an xml navigation and there are some differen categories in it.
But now I want that the button will have a color that is his categorie.
I used this code:
if( menuItem*.attributes.cat == "Vector work"){
var myColor:Color = new Color();
this.myColor.setRGB(0xff0000);
}
But that won’t do nothing.
This is the complete code:
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.firstChild.childNodes;
//tijdelijke variabelen
// y_as onthoud de y positie
// x_as onthoud de x positie
// tmp onthoud de beginwaarde.
//--------------------- Start positionering
var y_as= 40;
var x_as= 20;
var tmp = 20;
for (var i = 0; i<menuItem.length; i++){
item = attachMovie("itemClip", "itemClip"+i, i);
//Color
if( menuItem*.attributes.cat == "Vector work"){
var myColor:Color = new Color();
this.myColor.setRGB(0xff0000);
}
//hoog tmp op met 40 om knop naast de vorige te plaatsen.
tmp = tmp+30;
//ken de tijdelijke tmp toe aan x_as
x_as = tmp;
//telling begint met nul, om de if-statement te laten werken moet er één bij worden opgeteld.
var x = i+1;
//niet het laatste element van een rij
if(x%7 != 0){
item._x = x_as;
item._y = y_as;
}else if(i==0){
item._x = x_as;
item._y = y_as;
}else{
item._x = x_as;
//terugzetten naar oude waarden.
tmp = 20;
x_as = 20;
item._y = y_as;
y_as = y_as + 30;
}
//---------------------------- Einde positionering
And you can see the xml file on www.freshface.be/myData.xml
I hope that somebody can tell me what to do.
Thx