Chapter 25. Dynamic Skinning and the Drawing API

One of the largest differentiators of Flex and the Flash Player from traditional HTML-based Web development technologies is the Drawing API. The Drawing API allows you to programmatically render vector graphics on the screen within the Flash Player, and it is the foundation for dynamic skinning with the Flex framework. This chapter explores the Drawing API — what it is, and some of the things that you can do with it. The chapter also discusses programmatic component skins using the Drawing API, and additional imaging capabilities that the Drawing API provides.

Understanding the Drawing API

When people refer to the Flex and the Flash Player's Drawing API, they are referring to the set of classes that enable you to render vector graphics at runtime. The Drawing API allows you to draw various shapes, including lines and curves, in a programmatic fashion. This allows you to create polygons, or any other geometric shape. The Drawing API also allows you to render any of these shapes with any type of color, line thickness, fill, bitmap, or alpha transparency value.

While this sounds basic, it actually is the fundamental API that enables some very sophisticated component rendering. Most visual components in the Flex framework use the Drawing API to render themselves; they are typically not based on image assets. A Canvas, for example uses programmatic skins using the Drawing API to draw its borders and background colors. The header and control ...

Get Professional Adobe® Flex® 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.