I've been getting an error that I don't really understand and can't seem to
find what the problem is. The error is

VerifyError: Error #1068: mx.containers.Canvas and
mx.containers.Canvascannot be reconciled.

Here's what's I'm trying to do. I have a Canvas-based item renderer within a
TileList. The Item Renderer needs to change color depending on a few
different conditions. One of them is the number of business days elapsed
between two dates present in the object that provides the data to the item
renderer. The relevant functions are below.

The Flex docs say:
This error indicates that the ActionScript in the SWF is invalid. If you
believe that the file has not been corrupted, please report the problem to
Adobe.
I have also found:
http://editthis.info/flexerrorcodes/Main_Page

Neither posts really have a solution, has any one else seen this before, and
if so do you know of a workaround?

Thanks!
Rachel Maxim

<!-- item renderer -->
<mx:Canvas id="cnvDeal" creationComplete="setSelfColor(data,cnvDeal)">

private function setSelfColor(voData:Object,targetCnv:Canvas):void {

                   var now:Date = new Date();
                   var recd:Date = voData.received;
                   var busDays:int = businessDaysElapsed(recd,now);

                    if (busDays >= 7) {
                               targetCnv.setStyle("backgroundColor",
0xdb8e84);
                           }
                    else {
                               //set to light gray
                               targetCnv.setStyle("backgroundColor",
0xf1f1f1);
                           }

public static const millisecondsPerDay:int = 1000 * 60 * 60 * 24;

private function businessDaysElapsed(date1:Date,date2:Date):int {
                   var numberOfDays:int = 0;
                   while (date1 < date2) {
                       //if day is between monday and friday, add one day
                       if (date1.day >= 1 && date1.day <=5) {
                           numberOfDays ++
                       }
                       //increment date by a day
                       date1.setTime(date1.getTime() +
millisecondsPerDay);
                   }
                   return numberOfDays;
               }

Reply via email to