【问题标题】:AS3 VideoEvent Listener - Event.ReadyAS3 VideoEvent 侦听器 - Event.Ready
【发布时间】:2014-06-24 10:44:37
【问题描述】:

我正在尝试捕捉FLV Video PlayerREADY 事件。我不太确定这段代码发生了什么。 FLV playerAdobe Flash 导入,只要视频准备好播放,我就需要启动 readyHandler(函数将删除“视频正在加载”文本)。我完美地使用了video_oynattir 对象。但是,这些代码会破坏动画...

video_oynattir.addEventListener(Event.READY, readyHandler);

function readyHandler(event:VideoEvent):void
{
    trace("hurray");
}

并产生这个错误:

通过引用静态类型类来访问可能未定义的属性 READY*

如果我注释掉代码段。完美执行。

stage的完整代码如下:

import flash.events.MouseEvent;
import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.net.navigateToURL;

var clickTAG:String = loaderInfo.parameters.clickTAG;
var displayType:String = loaderInfo.parameters.displayType;

video_oynattir.autoPlay = false;

if(displayType == "collapse") {

    gotoAndStop("kapali");

}else{

    openButton.visible = false;
    gotoAndStop("acik");

}

video_button.addEventListener(MouseEvent.CLICK, videodurdur);

function videodurdur(e:MouseEvent):void {

    if(video_oynattir.state == "playing") {

        video_oynattir.stop();

    }else{

        video_oynattir.play();

    }

}

video_oynattir.addEventListener(Event.READY, readyHandler);

function readyHandler(e:VideoEvent):void {

    trace("at");

}

//Accesss of possibly undefined property READY through a refferance with static type class

closeButton.addEventListener(MouseEvent.CLICK, closeRichMedia);

function closeRichMedia(e:MouseEvent):void {

    video_oynattir.stop();
    ExternalInterface.call("dopushunlock");
    gotoAndPlay(3);
    openButton.visible = true;

}

openButton.addEventListener(MouseEvent.CLICK, openRichMedia);

function openRichMedia(e:MouseEvent):void {

    ExternalInterface.call("dopushlock");
    gotoAndStop(2);
    openButton.visible = false;

}

clickButton.addEventListener(MouseEvent.CLICK, gotoLink);

function gotoLink(e:MouseEvent):void {

    navigateToURL(new URLRequest(clickTAG), "_blank");

}

stop();

【问题讨论】:

    标签: actionscript-3 flash event-handling flvplayer


    【解决方案1】:

    请尝试将 EventListener 监听的事件类型更改为“VideoEvent”:

    video_oynattir.addEventListener(VideoEvent.READY, readyHandler);
    

    确保导入“fl.video.VideoEvent”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多