udjamaflip
04-07-2008, 12:16 PM
http://pastebin.com/d40bbeeb4
Can u have a look the trace(SelectedDate.indexOf(CurrentDate.dat)); returns 'undefined' any ideas why?
I did the pastebin for easier reading here is the code as well:
on (release) {
var SelectedDate:String
SelectedDate = MyCalendar.selectedDate;
var DateArray:Array = new Array();
DateArray.push({dat:"Apr 8", details:"Some event here..."});
DateArray.push({dat:"Apr 9", details:"Some event here..."});
DateArray.push({dat:"Apr 10", details:"Some event here..."});
DateArray.push({dat:"Apr 11", details:"Some event here..."});
DateArray.push({dat:"Apr 12", details:"Some event here..."});
//set wether a result has been found to no as default
var Found:Boolean;
Found = false;
//the var used for looping through the array
var Count:Number;
Count = 0;
//beginning of array loop through
while (DateArray[Count]) {
CurrentDate = DateArray[Count];
var TheDate:String;
var TheSelection:String;
TheDate = CurrentDate.dat;
TheSelection = SelectedDate;
trace(SelectedDate.indexOf(CurrentDate.dat));
if (SelectedDate.indexOf(CurrentDate.dat) > -1) {
var Result:String;
Result = CurrentDate.dat + ":\n" + CurrentDate.details;
Found = true;
}
Count++;
}
if (Found == true) {
infoLabel.text = Result;
}
if (Found == false) {
infoLabel.text = "Sorry:\n- Nothing was found for this date.";
}
}
Can u have a look the trace(SelectedDate.indexOf(CurrentDate.dat)); returns 'undefined' any ideas why?
I did the pastebin for easier reading here is the code as well:
on (release) {
var SelectedDate:String
SelectedDate = MyCalendar.selectedDate;
var DateArray:Array = new Array();
DateArray.push({dat:"Apr 8", details:"Some event here..."});
DateArray.push({dat:"Apr 9", details:"Some event here..."});
DateArray.push({dat:"Apr 10", details:"Some event here..."});
DateArray.push({dat:"Apr 11", details:"Some event here..."});
DateArray.push({dat:"Apr 12", details:"Some event here..."});
//set wether a result has been found to no as default
var Found:Boolean;
Found = false;
//the var used for looping through the array
var Count:Number;
Count = 0;
//beginning of array loop through
while (DateArray[Count]) {
CurrentDate = DateArray[Count];
var TheDate:String;
var TheSelection:String;
TheDate = CurrentDate.dat;
TheSelection = SelectedDate;
trace(SelectedDate.indexOf(CurrentDate.dat));
if (SelectedDate.indexOf(CurrentDate.dat) > -1) {
var Result:String;
Result = CurrentDate.dat + ":\n" + CurrentDate.details;
Found = true;
}
Count++;
}
if (Found == true) {
infoLabel.text = Result;
}
if (Found == false) {
infoLabel.text = "Sorry:\n- Nothing was found for this date.";
}
}