Where in the framework is the Graphics object passed around to achieve drawing?

て烟熏妆下的殇ゞ 提交于 2019-12-11 16:43:58

问题


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 hierarchy to achieve the drawing. I want to get to the level of 2D API.


回答1:


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.



来源:https://stackoverflow.com/questions/1611980/where-in-the-framework-is-the-graphics-object-passed-around-to-achieve-drawing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!