Well.. the first thing to note is using == means compare, not assign. So 
changing:

dayTitleBG == "0x002649";

TO:

dayTitleBG = "0x002649";


Will take care of that. Though in playing around with this, I found that 
backgroundColor is expecting a datatype of uint (unsigned int). So as a 
test case I made a custom component similar to yours and this appeared 
to do the job:

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";  width="100%"
    horizontalAlign="right" backgroundColor="{dayTitleBG}" 
creationComplete="setBackground()">
        <mx:Script>
        [Bindable]
        public var dayTitleBG:uint;
        [Bindable]
        public var dayBG:uint;
        public function setBackground():void
        {
                dayTitleBG = 0x002649;
                dayBG = 0xAF1E2D;
        }
        </mx:Script>
    <mx:VBox height="100%" backgroundColor="{dayBG}">
        <mx:Label text="blah..."  width="25" color="white"/>
    </mx:VBox>
</mx:HBox>




Ian Skinner wrote:
> <mx:HBox width="100%" horizontalAlign="right" backgroundColor="{dayTitleBG}" 
> creationComplete="setBackground()">
>       <mx:VBox height="100%" backgroundColor="{dayBG}">
>               <mx:Script>
>               [Bindable]
>               public var dayTitleBG:String;
>               [Bindable]
>               public var dayBG:String;
>               
>               function setBackground()
>               {
>                       if (data.date.month == calDate.month)
>                       {
>                               dayTitleBG == "0x002649";
>                               dayBG == "0xAF1E2D";
>                       }
>                       else
>                       {
>                               dayTitleBG == "0x405C77";
>                               dayBG == "0xC35662";
>                       }
>               }
>               </mx:Script>
>               <mx:Label text="{Day.format(data.date)}"  width="25" 
> color="white"/>
>       </mx:VBox>
> </mx:HBox>
>
> What did I do wrong in this code, it is not providing the desired result of 
> changing the background colors.  Probably related, what do I need to do for 
> the calDate object to exist in this dayFormat.mxml formater called from the 
> main MobileCalendar.mxml file?  I currently have it defined this way in the 
> main file.
>
> [Bindable]
> public var calDate:Date = new Date();
>
>   




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:37:2754
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/37
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:37
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to