Hi use uint for colors like getColor(swift:uint):uint

The uint class is primarily useful for pixel color values (ARGB and 
RGBA) and other situations where the int data type does not work 
well. For example, the number 0xFFFFFFFF, which represents the color 
value white with an alpha value of 255, can't be represented using 
the int data type because it is not within the valid range of the int 
values.

Cato



--- In flexcoders@yahoogroups.com, "oneproofdk" <[EMAIL PROTECTED]> wrote:
>
> In my first Flex2 app, I'm trying to set the background color of a
> canvas inside a repeater, to a specific color depending on a value 
in
> the datasource.
> 
> In my <mx:Script> I made this function:
> private function getColor(swift:String):String {
>    if (swift=='1') {
>       return '#FFFF00'
>    }else{
>       return '#FFFFFF'
>       }
> }
> 
> 
> <mx:Canvas
> backgroundColor="getColor({myRepeater.currentItem.left.page.swift})"
> width="50%">
> 
> This generates an error in FB when I save :
> 1067 - Implicit coercion of a value of type String to an unrelated
> type uint.
> 
> I'm pretty sure that I got this all wrong, isn't it possible to use
> the return value directly in the repeater, should I use a var to 
hold
> it - what to do ??
> 
> Any help telling me why (and why not) is greatly appreciated.
> 
> Thanks,
> Mark
>


Reply via email to