定义一个重载方法
可在你的ActionScript组件中重载一个基类的方法,只需简单地使用override关键字,例子:
package myComponents
{
import mx.controls.Alert;
import mx.containers.HBox;
import flash.display.DisplayObject;
public class HBoxWithAlert extends HBox
{
// Define the constructor.
public function HBoxWithAlert()
{
super();
}
// Define the override.
override public function addChild(child:DisplayObject):DisplayObject {
// Call super.addChild().
super.addChild(child);
// Open the Alert box.
Alert.show("Item added successfully");
return child;
}
}
}