我在創建自定義事件時得到一些奇怪的錯誤,看來事件被擴展到事件屬性不授予訪問:AS3 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轉換爲事件。
我在這裏丟失了什麼?
COMPLETE不存在,你擁有它註釋掉。 –