views:

21

answers:

1

Well i have the custom flv player which reads an XmL and draws circles on Flv video. Postion and time is specified in the XML. I did calculation with as3 getTimer() function. It works fine, no matter how long u pause and then play again. Circles are shown at right time.

Now i have two problems

1- How getTimer can be reset?? it is required when user is allowed to play another swf.. 2- Is there any other way besides getTimer calculation. I am not using Timer Class as it is Dependant on Frame-Script Execution time and may yield wrong result so this is not as accurate as getTimer() function. 3- As i am using Custom Slider , so i have to do calculations each time when user click or drag slider w.r.t getTimer() function and then subtracts seconds and all that. but again it goes very hard when user plays another swf as my calculations are based on getTimer() Funtion.

If any open-source project is available , kindly forward me link but i want it to run at Flash Player and air player too??

A: 

Hi Muhammad Irfan,

I'll try to point you in the right direction, but first answers to your questions:

  1. No
  2. No (besides using a Timer)
  3. It shouldn't be any more difficult

To expand on number 3, because this is where your solution lies, it really shouldn't be anymore difficult. What you need to do its track the time that the current FLV started. As long as you have that the math really is no different. The simplest thing would be to introduce your own reset function, and wrap getTimer in a custom function to add the rest functionality needed. Something like this:

var startTime:int;

function resetTimer():void {
    startTime = getTimer();
}

function getTime():int {
    return getTimer() - startTime;
}

In the above example, you would always access the current time from getTime rather than getTimer, beyond that everything is the same. Just make sure you call resetTimer when needed.

I hope that helps!

Tyler Egeto