Monday, January 31, 2011

Flex: White color issue with "wmode" set to "transparent" under 16-bit color depth

Recently I've faced with pretty strange issue in Flash Player. Our application written in Flex was using "wmode" parameter set to "transparent" in params for embeding flash to HTML:

AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"wmode","transparent",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);


Issue was related to rendering labels with white color when user had set up 16-bit color depth:


Example of code in Flex is pretty simple:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:VBox>
<mx:Label text="Some Label" color="#FFFFFF" fontFamily="Arial" fontSize="14" fontWeight="bold" />
<mx:Text text="Some Text" color="#FFFFFF" fontFamily="Arial" fontSize="14" fontWeight="bold" />

</mx:VBox>

</mx:Application>


After some investigation, solution was found - I've used "cacheAsBitmap" property set to "true" for text and label. After that issue vanished:

<mx:Label text="Some Label" cacheAsBitmap="true" color="#FFFFFF" fontFamily="Arial" fontSize="14" fontWeight="bold" />
<mx:Text text="Some Text" cacheAsBitmap="true" color="#FFFFFF" fontFamily="Arial" fontSize="14" fontWeight="bold" />


As result text and label was rendered correctly:

No comments:

Post a Comment