nice idea,
obviously you will need to use the date property for this one…
okeydoke lets have a crack shall we?
Today = new Date()
Tdate = Today.getDate()
Tmonth = Today.getMonth()
this gathers the current date…
now we want to use either a simple if statements to set a variable to a string ie. if(Tdate >= 14 && Tmonth <20 && Tmonth == 6){reminder = “your reminder”} or you can use an array representing each day of each month… this will be a lot easier to add reminders at a later date… but is a bit more complex…
ok, basically we will have 12 arrays named in a fashion such as this month0 (is january), month1 (is feb etc etc)… with the lengths specified:
jan = new Array(31)
feb = new Array(29)
mar = new Array(31)
apr = new Array(30)
may = new Array(31)
june = new Array(30)
july = new Array(31)
aug = new Array(31)
sept = new Array(30)
oct = new Array(31)
nov = new Array(30)
dec = new Array(31)
note that i think this could be done with a multi-dimensional array in a lot fewer lines but im stickin to what i know for now…
then you specify what reminder you want on which date in the following fashion:
july[17] = "fish"
then set the initial values for 2 variables to be used in loops…
if(Rdate == undefined){
Rmonth = Tmonth
Rdate = Tdate
}
now a whole load of code but its not that complex… basically it is a function called getRem which searches for the next reminder in each month:
function getRem(){
if(Rmonth == 0){
while(jan[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = jan[Rdate]
}
if(Rmonth == 1){
while(feb[Rdate]==undefined){
Rdate++
if(Rdate>29){
Rmonth ++
Rdate = 1
break
}
}
reminder = feb[Rdate]
}
if(Rmonth == 2){
while(mar[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = mar[Rdate]
}
if(Rmonth == 3){
while(apr[Rdate]==undefined){
Rdate++
if(Rdate>30){
Rmonth ++
Rdate = 1
break
}
}
reminder = apr[Rdate]
}
if(Rmonth == 4){
while(may[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = may[Rdate]
}
if(Rmonth == 5){
while(jun[Rdate]==undefined){
Rdate++
if(Rdate>30){
Rmonth ++
Rdate = 1
break
}
}
reminder = jun[Rdate]
}
if(Rmonth == 6){
while(july[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = july[Rdate]
}
if(Rmonth == 7){
while(aug[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = aug[Rdate]
}
if(Rmonth == 8){
while(sept[Rdate]==undefined){
Rdate++
if(Rdate>30){
Rmonth ++
Rdate = 1
break
}
}
reminder = sept[Rdate]
}
if(Rmonth == 9){
while(oct[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth ++
Rdate = 1
break
}
}
reminder = oct[Rdate]
}
if(Rmonth == 10){
while(nov[Rdate]==undefined){
Rdate++
if(Rdate>30){
Rmonth ++
Rdate = 1
break
}
}
reminder = nov[Rdate]
}
if(Rmonth == 11){
while(dec[Rdate]==undefined){
Rdate++
if(Rdate>31){
Rmonth = 0
Rdate = 1
break
}
}
reminder = dec[Rdate]
}
if(reminder == undefined){//just in case there are no reminders for the rest of this year
getRem()
}
}
if(reminder == undefined){
getRem()
}
if you want to have it display as you stated above you need to associate the names of the month with the number Flash uses…
if(Rmonth == 0){
FRmonth = "January"
}
if(Rmonth == 1){
FRmonth = "February"
}
if(Rmonth == 2){
FRmonth = "March"
}
if(Rmonth == 3){
FRmonth = "April"
}
if(Rmonth == 4){
FRmonth = "May"
}
if(Rmonth == 5){
FRmonth = "June"
}
if(Rmonth == 6){
FRmonth = "July"
}
if(Rmonth == 7){
FRmonth = "August"
}
if(Rmonth == 8){
FRmonth = "September"
}
if(Rmonth == 9){
FRmonth = "October"
}
if(Rmonth == 10){
FRmonth = "November"
}
if(Rmonth == 11){
FRmonth = "December"
}
and now to set the full reminder (including date of reminder):
Freminder = FRmonth + " " + Rdate + ": " + reminder
trace(Freminder)
ok?
that was pretty long… but kinda fun to do lol
if you have any questions/bugs please post!
Prophet.
NB i put all that script on the first frame of a brand new fla with nothing else in and used the trace function to check it…