【发布时间】:2011-01-27 23:26:42
【问题描述】:
当我尝试创建 addEventListener 时出现错误: 第 20 行 1046:类型未找到或不是编译时常量:事件。
package player {
import flash.media.Sound;
import flash.net.URLRequest;
public class Stream {
private var _Sound = null;
private var _Channel = null;
function Stream(){
this._Sound = new Sound();
}
public function play(url){
this._Sound.load(new URLRequest(url));
this._Channel = this._Sound.play();
this.addEventListener(Event.ENTER_FRAME, this.myFunction);
}
private function myFunction(e:Event){
}
}
}
【问题讨论】:
-
请看我修改后的答案。
-
让您的 Stream 类扩展 EventDispatcher 并导入 flash.events.EventDispatcher
-
你不需要使用所有的“这个”。前缀在这里。
标签: actionscript-3