Search code examples
apache-flexflashactionscript-3flvplayback

FLVPlayback - replay counter


Is there a way to output in the text filed a number of how many times the video looped? (how many times it has played)

Thanks, Yan


Solution

  • flex 4 example code:

    <?xml version="1.0" encoding="utf-8"?>
    

    < s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx">

            [Bindable]
            public var looped:Number=0;
    
            protected function videoplayer1_completeHandler(event:TimeEvent):void
            {
                looped++;
            }
    
        ]]>
    </fx:Script>
    
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>
    
    <s:VideoPlayer loop="true" complete="videoplayer1_completeHandler(event)" source="http://localhost/movie.flv"/>
    <s:Label text="{looped}"/>