我想从列表/数组中搜索或选择特定项目。所以在构建Flash中的AS3搜索功能时,我卡住了..请帮忙解决这个问题...提前谢谢
var ar:Array = new Array();
ar=[ "bhati", "malav", "vinod"];
//Searching Function
function findIndexOfValue( array:Array, _value:* ):int {
var _length:uint = array.length;
for(var i:uint=0; i < _length; i++) {
if(array[i] == _value) {
return i;
}
else{
return -1;
}
}
}
trace(findInndexOfValue( ar, "bhati" )); // it should output 0 .
//compiler error:- 1170:Function doesn't return a value., I tried my best, but unable to solve this.