473,666 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

flv and contents preloader

11 New Member
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 1452

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

Similar topics

4
3098
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 cache. If the stopPreload() function is activated and the ret val set to false, the preload() function still continues to the end. Any suggestions on how to stop the preload() function in its process, what conditions are necessary?
2
2048
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, then follow links on that page, looking for images within that website (say one page deep). Once found, could the images be preloaded into the browser cache? Many thanks for your help!
8
2016
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? http://www.nssdesign.scot.nhs.uk/home/index.php
3
7951
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 app??? (if you look at www.abmpic.com you will see that it takes too long to load without a preloader)
2
2064
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 loads the header image before the rest of the graphical content on the page. however, what appears to be happening, judging by the status bar messages, is that the banner always loads last. here's the random header code -
1
3190
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. Presently the code stands at: if (_root.getBytesLoaded() ==_root.getBytesTotal()) {** _root.gotoAndPlay(5);
0
2008
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 session, as if the swf is loaded into memory and replays. Is my assumption correct and how exactly do I do this with my preloader?
2
1912
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 appears on the screen. I have the preloader located on frame 1 & 2 of the first scene. When I test the movie out of Flash and I view bandwidth and simulate a download, it shows that the movie is at Frame 0 for approximately 10 seconds. (I am...
3
1663
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 normal speed I'm not sure if it's happening then. Ever seen this before? Thx.
0
8352
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.