创建 CustomEvent 时出现一些奇怪的错误,似乎正在扩展的事件无法访问事件属性:
package
{
import flash.events.Event;
public class CustomEvent extends Event
{
//public static const COMPLETE:String = 'complete';
private var _assetName:String;
public function get assetName ():String
{
return _assetName;
}
public function set assetName ( aname:String ):void
{
_assetName = aname;
}
public function CustomEvent (type:String, bubbles:Boolean = false, cancelable:Boolean = false)
{
super (type, bubbles, cancelable);
}
public override function clone ():Event
{
return new CustomEvent(type, bubbles, cancelable) as Event;
}
}
}
做的时候:
myObj.addEventListener(CustomEvent.COMPLETE, objLoaded);
我收到 COMPLETE 不存在的错误...好的,我将其设置到该位置,然后它抱怨无法将 CustomEvent 转换为 Event。
我在这里想念什么?