I am trying to catch READY
event of FLV Video Player
. I am not quite sure what is going on with this codes. FLV player
is imported by Adobe Flash
and I need to start readyHandler whenever video is ready to play (Function will erase the "Video is loading" text). I used video_oynattir
object flawlessly. However, these codes brake the animations...
video_oynattir.addEventListener(Event.READY, readyHandler);
function readyHandler(event:VideoEvent):void
{
trace("hurray");
}
And produce this error:
Accesss of possibly undefined property READY through a refferance with static type class*
If I comment out code segment. It executes perfectly.
Full code of stage as follows:
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();
Please try to change the event type the EventListener listens to to "VideoEvent":
Make sure to import "fl.video.VideoEvent".