apache-flex - 弹性 : How to create an entirely new component?

标签 apache-flex user-interface

我想为 Flex 开发一个网络图应用程序 - 想象一下将节点放置在 Canvas 上并通过链接将它们连接起来。节点应该具有可编辑的文本和其他 UI 组件。

我试图找到从头开始创建全新 UI 组件的示例,但我能找到的只是扩展现有组件的微不足道的示例:例如,扩展 Button 的 RedButton,或具有状态的 ComboBox从中选择。

我的主要问题是,什么 ActionScript 方法定义了组件的绘制? Java 的paint() 方法的ActionScript 等价物是什么?

最佳答案

您想创建一个覆盖 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

关于apache-flex - 弹性 : How to create an entirely new component?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/489024/

相关文章:

apache-flex - 如何判断 MXML 组件何时完全完成创建?

java - 从 AbstractTableModel 获取列名

Java Swing GUI 更新/从方法更改 - 循环卡住

apache-flex - 弹性 3 : passing values to function using alert window

string - 如何在ActionScript中将字符串转换为 boolean 值?

user-interface - PyQt5 信号和插槽 'QObject has no attribute' 错误

ios - 如何在 iOS 中的图像和文本字段之间创建空间

java - Android:TextInputLayout 不会将提示居中

javascript - 如何让Flash应用程序与服务器通信?

java - 如何使用 Log4J 设置我的 BlazeDS 实现?