• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1278
  • Last Modified:

How do I continuously update a current time text display with FLVPlayback?


I have the FLVPlayback component in an AS3 document.

I have found that the current time of the FLV video is available via

myFLVPlayback.playheadTime (considering myFLVPlayback is the instance name of my object)

BUT this variable only gets updated every "state change" via a listener that calls a function every "stateChange"

How do I continuously update this text box to display the most up to date value of playheadTime? I know that NetStream's netStream.time works very well, but I'd rather not recode using netstreams.

PS. I have a dynamic text box named CURRENTTIME.

Thank you.

function listenerObjectStateChange(eventObject:Object):void {
    controlsMC.CURRENTTIME.text = formatTime(vid.playheadTime);
vid.addEventListener("stateChange", listenerObjectStateChange);

Open in new window

  • 2
1 Solution

            var myTimer:Timer = new Timer(1000, 2);
            myTimer.addEventListener("timer", timerHandler);

        function timerHandler(event:TimerEvent):void {
            controlsMC.CURRENTTIME.text = formatTime(vid.playheadTime);

       something along these lines should work
dsrnuAuthor Commented:
Perfect! Thank you!

I inserted myTimer.start() inside the (initial) play button, and changed the repeat on the timer to the total time of the video.

dsrnuAuthor Commented:
Thank you very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now