Hi,
I’m loading in a menu dynamically, using XML and css, just like Kirupas tutorial.
I want each nav text to change color when i do a mouse rollover, and then change back at mouse roll out.
How can i do this when the color is specified in the CSS file? Is there a way to do this just in the function?
Here is my code (same as Kirupas):
mclListener.onLoadInit = function(target_mc:MovieClip) {
// add link property
target_mc.linkURL = astrLinks[nCounter];
target_mc.navText = astrText[nCounter];
// add events
target_mc.onPress = buttonClick;
//declare variables
var buttonImgHeight:Number = target_mc._height;
var buttonImgWidth:Number = target_mc._width;
//set distance between buttons
target_mc._y = Math.round( yPosition );
yPosition += buttonImgHeight+1;
// place the text on the button and center the text
target_mc.createTextField( "buttonText", nCounter, 0, 0, buttonImgWidth, buttonImgHeight );
// set properties of textField
target_mc.buttonText.border = false;
target_mc.buttonText.selectable = false;
target_mc.buttonText.wordWrap = true;
//set button text
target_mc.buttonText.styleSheet = my_css;
target_mc.buttonText.htmlText = "<.buttonStyle>"+ astrText[nCounter] +"</.buttonStyle>";
//set filters (disabled)
//target_mc.buttonText.filters = filterArray;
// center the text vertically in the button
target_mc.buttonText.autoSize = true;
var nMiddle:Number = ( buttonImgHeight/2 );
target_mc.buttonText._y = nMiddle - ( target_mc.buttonText._height/2 );
nCounter += 1;
//new Tween(target_mc, "_alpha", Strong.easeOut, 0, 100, 1, true );
};