473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Elapsed time in Flash for flv files

1
Hi! I'm new to all this. I need help.

I imported a quicktime movie and am using Flash skins and actionscript I found online. However, I ended up playing the quicktime flv twice in succession and the controls working on the top only. Once I pause the timer kept going and I could still hear the audio.

I'm not big on actionscript and would love some help. Here's the script I'm using.
Expand|Select|Wrap|Line Numbers
  1.  
  2. stop();
  3. var nc:NetConnection = new NetConnection();
  4. nc.connect(null);
  5.  
  6. var ns:NetStream = new NetStream(nc);
  7.  
  8. ns.setBufferTime(30);
  9. ns.onStatus = function(info){
  10. if(info.code == "NetStream.Buffer.Full"){ 
  11. bufferClip._visible = false;
  12. }
  13. if(info.code == "NetStream.Buffer.Empty"){ 
  14. bufferClip._visible = true;
  15. }
  16. if(info.code == "NetStream.Play.Stop"){ 
  17. bufferClip._visible = 0;
  18. }
  19. }
  20.  
  21. theVideo.attachVideo(ns);
  22.  
  23. ns.play("WordPlay.flv");
  24.  
  25. var time_interval:Number = setInterval(checkTime, 500, ns);
  26. function checkTime(myVideo_ns:NetStream) {
  27. var ns_seconds:Number = myVideo_ns.time;
  28. var minutes:Number = Math.floor(ns_seconds/60);
  29. var seconds = Math.floor(ns_seconds%60)
  30. if (seconds<10) {
  31. seconds = ("0"+seconds);
  32. }
  33. time_txt.text = minutes+":"+seconds;
  34. }; 
  35.  
  36.  
  37. rewindButton.onRelease = function() {
  38. ns.seek(0);
  39. }
  40.  
  41. var videoInterval = setInterval(videoStatus,100);
  42. var amountLoaded:Number;
  43. var duration:Number;
  44.  
  45. ns["onMetaData"] = function(obj){
  46. duration = obj.duration;
  47. }
  48. function videoStatus() {
  49. amountLoaded = ns.bytesLoaded / ns.bytesTotal;
  50. loader.loadbar._width = amountLoaded * 210;
  51. loader.scrub._x = ns.time / duration * 210;
  52. }
  53.  
  54. var scrubInterval;
  55.  
  56. loader.scrub.onPress = function(){
  57. clearInterval(videoInterval);
  58. scrubInterval = setInterval(scrubit,10);
  59. this.startDrag(false,0,this._y,210,this._y);
  60. }
  61.  
  62. loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
  63. clearInterval(scrubInterval);
  64. videoInterval = setInterval(videoStatus,100);
  65. this.stopDrag();
  66. }
  67.  
Mar 14 '08 #1
1 3250
amitpatel66
2,367 Expert 2GB
Thread moved to Action Script forum

MODERATOR
Mar 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: NotGiven | last post by:
Below is a good elapsed time function I found. However, I'd like to return total seconds instead of broken down into days, hours, minutes & seconds. In other words, I want "125" instead of "2...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
11
by: Philip Wagenaar | last post by:
Hello, I am using a timer object in my Windows Forms Application. Does the code in ..elapsed event run in a diffrent thread? If the interval is set to 10 milliseconds and the time to execute the...
4
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying...
4
by: Liverpool fan | last post by:
I have a windows application written using VB .NET that encompasses a countdown timer modal dialog. The timer is a System.Timers.Timer with an interval of 1 second. AutoReset is not set so accepts...
2
by: avanhalen | last post by:
To embed flash objects in my pages, I read them from a database. A script file (Filedownload.aspx) reads it from the database, and streams it to the browser. Here are two example flash objects...
12
by: Spitfire | last post by:
I've a requirement to find the elapsed time between two function calls. I need to find the time elapsed accurate to 1 millisecond. The problem I'm facing right now is that, I'm using the 'time()'...
12
by: pekka | last post by:
I'm trying to measure user input time with my Timer class object. It isn't as easy as I expected. When using std::cin between timer start and stop, I get zero elapsed time. For some unknown reason,...
9
by: Ross | last post by:
I'm a newbie at this, and have searched a lot but can't find something that seems appropriate for measuring a recurring elapsed time. Creating an object with: var mydate = new Date(); seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.