Where in the framework is the Graphics object passed around to achieve drawing?
I'm trying to understand how the Flex framework draws objects (Button, Label, Image, etc.). The Button class seems to draw itself by addChild()ing its ProgrammaticSkin. However, where in the framework is the Graphics object being passed around in the hierarc开发者_如何学Chy to achieve the drawing. I want to get to the level of 2D API.
There is no single global graphics object in flash/flex. Every Shape and Sprite (UIComponent is a Sprite) has a graphics
object of type Graphics that can be drawn on. In a flex app, programmatic drawing should be done in the overriden updateDisplayList method of the component. You should use the component's unscaledWidth
and unscaledHeight
as its bounds while drawing on it.
精彩评论