Can’t get this working but must be easy to fix! I have a list component populated with XML data. When the user makes a selection the alpha value of “s1 s2 and s3” change. It all works except they all stay changed when another selection is made. I need them to return to their original state when another selectiion is made ie. only one change at a time. I think if I can get the var “selected number” outside the function “selectPiece” it’ll work but when I try to do this I get the error message “Access of undefined property select piece” Here’s my code:-
s1.alpha=.1;
s2.alpha=.1;
s3.alpha=.1;
function selectPiece(evt:Event):void {
trace("selected "+evt.target.selectedIndex);
taPrice.text=piecesXML.piece[evt.target.selectedIndex].price+" €";
taRef.text=piecesXML.piece[evt.target.selectedIndex].ref;
loader1.source="images/"+piecesXML.piece[evt.target.selectedIndex].ref+".swf";
taQty.text=piecesXML.piece[evt.target.selectedIndex].qty;
var selectedNum:int=(evt.target.selectedIndex);
trace(selectedNum);
var aCircle:Array=new Array(s1,s2,s3);
aCircle[selectedNum].alpha=1;
}
l1.addEventListener(Event.CHANGE,selectPiece);
If you can help I would really appreciate it, even if you think the above is dreadful coding and needs a total re-write, I want to learn! That’s it - I get the feeling that a lot of people who post problems here are those who like me don’t have a strong programming background but are forced to do some- What we find difficult is how to structure the code where to put the bits, so perhaps a good basic tutorial on this would help or perhaps it’s just me!