473,385 Members | 1,817 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,385 software developers and data experts.

flv and contents preloader

I'm trying to play flv on frame 1 after both flv and contents on frame 2 are loaded.

how can I stop flv from playing before the contents are loaded?



AS on frame 1

Expand|Select|Wrap|Line Numbers
  1.  
  2. stop();
  3.  
  4. var loadSize:Number = getBytesTotal();
  5.  
  6.  
  7.  
  8. var nc:NetConnection = new NetConnection;
  9. nc.connect(null);
  10. var ns:NetStream = new NetStream(nc);
  11.  
  12. myVideo.attachVideo(ns);
  13.  
  14.  
  15. ns.play("flv3a.flv");
  16.  
  17. /********* flv preloader********/
  18.  
  19. this.createTextField("loaded_txt", this.getNextHighestDepth(), 0, 0, 160, 22);
  20. var loaded_interval:Number = setInterval(checkBytesLoaded, 500, ns);
  21. function checkBytesLoaded(my_ns:NetStream) {
  22.     var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
  23.     loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";
  24.  
  25.  
  26. /********* contents preloader ********/
  27.  
  28.    loaded = getBytesLoaded();
  29.  
  30.     var percentField:Number = Math.round(loaded / loadSize * 100);
  31.  
  32.     ////
  33.  
  34.     frameNum = Math.min(pctLoaded, percentField)
  35.  
  36.  
  37.  
  38.      loader.gotoAndStop(frameNum);
  39.  
  40.    if ( Math.min(pctLoaded, percentField) >= 100) {
  41.         clearInterval(loaded_interval);
  42.  }
  43.  }
  44.  
  45.  
  46. /********* cue point ********/
  47.  
  48.  
  49.  
  50. var ourListener:Object = new Object();
  51. ourListener.cuePoint = function(eventObject:Object):Void{
  52.     if(eventObject.info.name == "first"){
  53.         play();
  54.  
  55.         }
  56. }
  57.  
  58. myVideo.addEventListener("cuePoint",ourListener);
  59.  
  60.  
  61.  

Thank you
Oct 28 '07 #1
0 1444

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

Similar topics

4
by: David | last post by:
Hi everyone, I am trying to stop an image preload sequence by the click of a mouse but have been unsuccessful trying several methods. Imagine this simple script below that loads 50 images to...
2
by: sean.f.duffy | last post by:
Hi! I am an effectivebrand.com toolbar user and would love to add a preloader to my toolbar, but am having problems doing this. Is it possible to have javascript look at the URL of a webpage,...
8
by: Ross | last post by:
This page I am trying to create a preloader that hides all the other content except the hidepage div until it loads...any ideas? Or any preloaders that actually work? ...
3
by: abm | last post by:
Hi. I am in great need of a preloader for my Flash web site. I have looked at a lot of tutorials and examples, but I can not seem to get it to work. How do I add a preloader to my existing Flash...
2
by: bedges | last post by:
okay, the scenario: i have a header image which changes randomly across all pages in the site. that works fine. i also have an image preloader within the random header picker which theoretically...
1
by: 031179 | last post by:
Hi I'm having lots of problems trying to apply a preloader to the following site: http://www.publishingme.com/niaomh/index.html I have tried different websites and tutorials but no luck....
0
by: Lanky | last post by:
I have noticed on sites that on a page a preloader will run and one or more flash movies will appear. Then the preloader does not reappear on subsequest revists to that page during the same browser...
2
by: streammalvern | last post by:
Hi, I am having a problem with a published Flash Movie. I included a preloader and the whole file size of the .swf is only about 1MB. If I go to the movie, it pauses even before the preloader...
3
by: 1left | last post by:
Hi- I'm getting some weird flickering of objects (not the preloader elements) during the "Simulate Download" test (56k) of my Flash 8 movie. I'm on cable modem , and the preloader runs so fast at...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.