Hi there- I have a simple array that populates a textfield. I want to read the array indices in reverse order when each is clicked from last to first. For instance (and this is working):
//create array
var h:Array = new Array("a", "b", "c");
//create textfield code... truncated
//populate textfield
t.htmlText += "<a href='event:"+ h[h.length-1] +"'>"+ h[h.length-1] +"</a>"
//listen for TextEvent
tf.addEventListener(TextEvent.LINK, tfClicked);
function tfClicked(e:TextEvent):void {
trace(getIndex());
function getIndex():Number {
[b]//if clicked from last to first it will trace (2,1,0)
//but want it to trace (0,1,2)[/b]
for (var i:uint = 0; i > h.length; i++) {
if (h[i] == evt.text) {
return i;
}
}
return -1;
}
Any advice is appreciated!