FLEX: videoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE) doesn't work

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-04-11T13:16:41Z Indexed on 2010/04/11 13:23 UTC
Read the original article Hit count: 771

Filed under:

hi,

the PLAYHEAD_UPDATE event is not triggered by my videoDisplay component in Flex.

If I add the attribute playheadUpdate="playUpdate()" everything works fine.

But in the following code, the method "playUpdate()" is not triggered... thanks

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()">

    <mx:Script><![CDATA[

        import mx.events.VideoEvent


 private function init():void {

...
    videoD.addEventListener(VideoEvent.PLAYHEAD_UPDATE, playUpdate);

}

    private function thumbPressed():void {
        videoD.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, playUpdate);  
    }

    private function thumbReleased():void {
        videoD.addEventListener(VideoEvent.PLAYHEAD_UPDATE, playUpdate);
    }

    private function playUpdate():void {
        debugF.text = "OK";
        slider.value = videoD.playheadTime;     
    }


    ]]></mx:Script>

<mx:VideoDisplay id="videoD" autoPlay="{autoPlayOption}" source="{videoPath}" click="togglePlay()" />

The text OK is not displayed, and the slider is not updated. As I mentioned before, adding the attribute in MXML, works, instead.

© Stack Overflow or respective owner

Related posts about flex