我想为 Flex 开发一个网络图形应用程序 - 想象一下将节点放置在 Canvas 上并用链接将它们连接起来。节点应具有可编辑文本和其他 UI 组件。
我试图找到从头开始创建全新 UI 组件的示例,但我所能找到的只是扩展现有组件的琐碎示例:例如,扩展 Button 的 RedButton 或具有以下状态的 ComboBox从中选择。
我的主要问题是,什么 ActionScript 方法定义了组件的绘制?ActionScript 中相当于 Java 的 Paint() 方法的是什么?
您想要创建一个覆盖 updateDisplayList 方法的组件,并在其中进行绘图:
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList( unscaledWidth, unscaledHeight );
// The drawing API is found on the components "graphics" property
graphics.clear();
graphics.lineTo( 0, unscaledWidth );
// etc
}
更多信息可以在这里找到:http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_3.html http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_3.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)