Answered
Array Comparison ( Flash 8 )
Hello,
I am trying to write a function that will "highlight" days in a month--for a calendar I'm making.
The dates I have come in from PHP/MySQL look like this: YYYY-MM-DD.
I split up the date by "year", "month" and "day" then put them into an array like so:
////CODE////
[...]
function editDateResults( d:Array ){ // d = an array full of dates formated YYYY-MM-DD
for( var i:Number=0 ; i < d.length ; i++){
year.push( parseInt( d .substring( 0 , 4 ) ) );
month.push( parseInt( d.substring(5 , 7 ) ) );
day.push( parseInt( d .substring(8 , 10 ) ) );
}//end for
}//end function
[...]
////END CODE////
How do I take those arrays and line them up with my Calendar days.
I tried something like this. DON'T LAUGH! It worked kind of! LOL
////CODE////
var l:Number = 0;
var d:Number = 0;
var count:Number = 0;
function highlightDay( ){
count = 0; //reset;
while( true ){
count++;
l++;
l %= month.length;
d++;
d %= 31;
if( monthsByNumber+1 == month and d == day ){ // n
= a number changed by pressing "next" or "prev" button
var DayColor = new Color( Calendar["daycube"+ d] ); //Calendar = main clip. "daybube" is just a little cube with a number representing the day ( inside Calendar ).
var colorTransform:Object = { ra:50 , ga:50 , ba:50 };
DayColor.setTransform( colorTransform );
Calendar["daycube"+d].hasEvent = true;
Calendar["daycube"+d].eventNumber = l;
}else{
var DayColor = new Color( Calendar["daycube"+d] );
var colorTransform:Object = { ra:100 , ga:100 , ba:100 };
DayColor.setTransform( colorTransform );
Calendar["daycube"+d].hasEvent = false;
}//end if
if( count >= ( month.length * 31) ){ break }; //how many times to check
}//end while
}//end function
////END CODE////
Thanks for any help you can give!
I am trying to write a function that will "highlight" days in a month--for a calendar I'm making.
The dates I have come in from PHP/MySQL look like this: YYYY-MM-DD.
I split up the date by "year", "month" and "day" then put them into an array like so:
////CODE////
[...]
function editDateResults( d:Array ){ // d = an array full of dates formated YYYY-MM-DD
for( var i:Number=0 ; i < d.length ; i++){
year.push( parseInt( d .substring( 0 , 4 ) ) );
month.push( parseInt( d.substring(5 , 7 ) ) );
day.push( parseInt( d .substring(8 , 10 ) ) );
}//end for
}//end function
[...]
////END CODE////
How do I take those arrays and line them up with my Calendar days.
I tried something like this. DON'T LAUGH! It worked kind of! LOL
////CODE////
var l:Number = 0;
var d:Number = 0;
var count:Number = 0;
function highlightDay( ){
count = 0; //reset;
while( true ){
count++;
l++;
l %= month.length;
d++;
d %= 31;
if( monthsByNumber
var DayColor = new Color( Calendar["daycube"+ d] ); //Calendar = main clip. "daybube" is just a little cube with a number representing the day ( inside Calendar ).
var colorTransform:Object = { ra:50 , ga:50 , ba:50 };
DayColor.setTransform( colorTransform );
Calendar["daycube"+d].hasEvent = true;
Calendar["daycube"+d].eventNumber = l;
}else{
var DayColor = new Color( Calendar["daycube"+d] );
var colorTransform:Object = { ra:100 , ga:100 , ba:100 };
DayColor.setTransform( colorTransform );
Calendar["daycube"+d].hasEvent = false;
}//end if
if( count >= ( month.length * 31) ){ break }; //how many times to check
}//end while
}//end function
////END CODE////
Thanks for any help you can give!
