I have made an AIR app that brings in local SWF files and displays them in an interface. One particular local SWF file contains a FLVPlayback component. On this component I've placed some event Listeners.
vod.player_flvp.addEventListener(fl.video.VideoEvent.PLAYHEAD_UPDATE, vodPlayheadUpdate);
vod.player_flvp.addEventListener(fl.video.VideoEvent.STATE_CHANGE, vodStateChange);
vod.player_flvp.addEventListener(fl.video.VideoEvent.COMPLETE, vodStateComplete);
private function vodPlayheadUpdate(e:fl.video.VideoEvent):void{};
private function vodStateChange(e:fl.video.VideoEvent):void{};
private function vodStateComplete(e:fl.video.VideoEvent):void{};
I'm using a code injection method to bring in this local SWF file.
var swfBytes:ByteArray = new ByteArray();
var file:File = File.desktopDirectory.resolvePath(finalListingArray[topicNum].nativePath);
var loadStream:FileStream = new FileStream();
loadStream.open( file, FileMode.READ );
loadStream.readBytes( swfBytes );
loadStream.close();
var loader:Loader = new Loader();
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.allowLoadBytesCodeExecution = true;
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, stopLoadedContent);
loader.loadBytes( swfBytes, loaderContext );
tmpTopic.reRoutePath = file.parent.url+"/";
tmpTopic.addChildAt(loader,0);
The loading happens fine, the SWF is displayed. Then I get the following error below and I don't know how to start to debug the error. What does it mean? How do I resolve it?
TypeError: Error #1034: Type Coercion failed: cannot convert fl.video::VideoEvent@20d10141 to fl.video.VideoEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::setState()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::finishAutoResize()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()