flash data integration:
I posted this question in the actionscript forum, but no response.
What I am trying to do is create multiple instances of a button, hundreds in a
grid. When the user rolls over the button, which is at 1% alpha in its 'up'
state, the button will appear at 100% in the 'over' state, then fade in the
'out' state.
The buttons are created using xml, each button has a text field, each text
field will be linked to its own text (a name) through the xml.
I found a good tutorial online that takes you to the point where you can load
the xml into the actionscript and if you DONT have several states, it works
fine. My problem comes in when I try to give it the up, over, and out. Two
things occur in the code I will attach. One is that no matter which button you
hover over, only the last goes into the over state. The other is that the text
will only properly appear in the first frame. When you go to the 'over' state,
the only text that appears is when you embed the text. Otherwise, you get
nothing.
I have looked all over for a tutorial or a forum that might talk about how to
do this, and cant find anything. Help, please.
myXML=new XML();
myXML.ignoreWhite=true;
myXML.onLoad=function(ok){
if(ok){
allData=this.firstChild.childNodes;
for(i=0;i<allData.length;i++){
newBut=_root.attachMovie('butTemp','but'+i,i)
newBut._y=50;
newBut._x=(i*120)+50;
newBut.but_txt.text=allData[i].attributes.text
newBut.onRollOver = function(){
newBut.gotoAndPlay('over');
}
newBut.onRollOut= function(){
newBut.gotoAndPlay('out');
}
}
}else{
trace('error');
}
}
myXML.load('navII.xml');