Chapter 4. Graphics
With the introduction of the Spark architecture in the Flex 4 SDK,
graphics have become first-class citizens and can be sized and positioned
within a layout along with the other elements in the container’s display
list. As in previous versions of the SDK, vector graphics are rendered using
the drawing API of a read-only flash.display.Graphics object held on the lowest
layer of a Sprite-based element. Yet for
Flex 4, the concept has been given an overhaul. Now display objects are
created and held internally by GraphicElement-based elements to render graphics,
providing a level of abstraction that allows for graphics to be treated the
same as any other visual element within a layout.
Along with this new graphical rendering concept, Flex 4 incorporates the Flash XML Graphics (referred to as FXG) format, which is a readable vector graphics format that is interchangeable between multiple software tools and does not require knowledge of the ActionScript language or MXML markup.
A FXG fragment is a grouping of graphical elements, such as shapes, text, and raster images, along with optional masking and filters that can be contained inline in MXML or within a FXG document with the .fxg file extension. FXG is a subset of MXML and does not include the ability to reference external classes or respond to runtime events, such as data binding and state changes. However, FXG fragments can be declared inline in MXML to take advantage of such features, which most skin classes in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access