2
votes

Need help with this as3 code that used to work in Flash CS5.5 but now is not working with Flash CS6.

I got a FLVPlayback instance called myVideo in the stage and Im trying to capture the "seek" event using this code:

import fl.video.*;
import fl.video.FLVPlayback;
import fl.video.VideoEvent;

myVideo.addEventListener(VideoEvent.SEEKED, seekHandler);

function seekHandler(myEvent:VideoEvent) {
    trace("seeked");
}

At this point I got the next error when I publish:
1119: Access of possibly undefined property SEEKED through a reference with static type Class.

I have readed something about strict mode in as3.. I uncheck that option and now I got this output when I try to seek another point in the video player:

TypeError: Error #1034: Type Coercion failed: cannot convert fl.video::VideoEvent@4697c239 to flash.events.VideoEvent.

Can anybody show me what Im doing wrong if this works on flash CS5.5. Thanks!!

2
because there is a VideoEvent Class in import fl.video.VideoEvent; and also flash.events.VideoEvent. the myVideo is firing a fl.video.VideoEvent... but your listener is listening to a flash.events.VideoEvent. to test.. change to function seekHandler(myEvent:fl.video.VideoEvent).Jason Reeves
@JasonReeves you should put that as the answer. I was about to type it up and then I noticed your comment. Luis: Double check your import statements, it's likely this happened by mistake. Also, go back to strict mode :DSunil D.

2 Answers

4
votes

because there is a VideoEvent Class in import fl.video.VideoEvent; and also flash.events.VideoEvent. the myVideo is firing a fl.video.VideoEvent... but your listener is listening to a flash.events.VideoEvent. to test.. change to function seekHandler(myEvent:fl.video.VideoEvent).

Glad you got it!!

-1
votes

Sadly adobe flash CS5 and CS6 have this problem,

change myEvent to myEvent:fl.video.VideoEvent

best