Web application R&D notes, from the world of Java, Flex, CSS, XHTML, Flash, .NET, cross-browser compatibility, JavaScript, AJAX, ADA compliance, Photoshop, and any and all things related to Web development!
Showing posts with label background image. Show all posts
Showing posts with label background image. Show all posts
21 December 2009
06 November 2008
Degrafa for Flex Enables Control of Background Images
If you've ever wrestled with background images for Flex components, there's a powerful library to make your life easier: Declarative Graphics Framework (Degrafa). I'd implemented a paging mechanism for an AdvancedDataGrid; then I added a background image to the Application container,
The height property on the AdvancedDataGrid was set to 100% and the variableRowHeight="true"; however, this was giving me grief: For whatever reason, the record at the bottom of the grid was cut off. And the scrollbar stopped a few steps before it could completely reach it. After some trial-and-error, two solutions emerged:
Some research led me to this great blog by Brendon Wildbore. The solution was to use his code example along with the Degrafa SWC file in the project's lib folder. Instructions on downloading and installing the SWC can be found on the Degrafa web site. Following Brendon's example, I changed the CSS to look like this,
And the problem disappeared. The image now stays the same size. However, the image was too dark; a check of the values and it was clear that the background-blend: multiply; was the culprit. Changed it to normal and all is well.
The Degrafa library allows for much more than this. Check out their site to see the capabilities.
<mx:Style>
Application {
background-image: Embed("global/media/flower.png");
}
</mx:Style>
The height property on the AdvancedDataGrid was set to 100% and the variableRowHeight="true"; however, this was giving me grief: For whatever reason, the record at the bottom of the grid was cut off. And the scrollbar stopped a few steps before it could completely reach it. After some trial-and-error, two solutions emerged:
- Take the height property off completely and keep variableRowHeight="true".
- Or set the rowHeight to some value and set variableRowHeight="false". The trouble was, this meant all the rows would be the same height. Not very aesthetically pleasing.
Some research led me to this great blog by Brendon Wildbore. The solution was to use his code example along with the Degrafa SWC file in the project's lib folder. Instructions on downloading and installing the SWC can be found on the Degrafa web site. Following Brendon's example, I changed the CSS to look like this,
<mx:Style>
Application {
background-image: Embed("global/media/flowers.png");
background-repeat: repeat;
background-position: center;
background-blend: normal;
borderSkin: ClassReference("com.degrafa.skins.CSSSkin");
}
</mx:Style>
And the problem disappeared. The image now stays the same size. However, the image was too dark; a check of the values and it was clear that the background-blend: multiply; was the culprit. Changed it to normal and all is well.
The Degrafa library allows for much more than this. Check out their site to see the capabilities.
Subscribe to:
Posts (Atom)