RE: [Flashcoders] preloader not completely preloading...

2006-12-11 Thread Alain Rousseau
The only place I see where this could fail, is at your if line. 
You should probably calculate nTBytes outside your checkLoad() function and
pass it as a variable at your first call.

for your if statement you should maybe write it like this :

var minPercentLoad:Number = 100;
if ( nPercent == minPercentLoad) {
//...
}

that way you'll be sure that your movie has loaded all the way before doing
anything else.


HTH

Alain

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Count
Schemula
Sent: 11 décembre 2006 09:12
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] preloader not completely preloading...

I'm using the code at the bottom of this post.

Using the Simulate Download and the Bandwidth profiler, I have two different
files where it's basically downloading about 15% of the file and then
continuing playing.

The preloader starts to work correctly, but basically quits out incorrectly
around 15%.

Looking at the bandwidth profiler, it continues downloading in the
background while trying to (poorly) play.

Any obvious hangups?

No components are in use, all assets are inside the flash file. The
bandwidth profiler shows a linear download, 0 to 100%, just around 15% or so
it just goes on and tries the play the file after showing me the preloader
for the first 15%.

I've used this code successfully before, it's just that now I have a
deadline, so, I guess it totally makes sense that it does not work now. Grr.

=== CODE ===

// preloader
function checkLoad(mcTarget:MovieClip):Void{
  var nLBytes:Number = mcTarget.getBytesLoaded();
  var nTBytes:Number = mcTarget.getBytesTotal();
  var nPercent:Number = (nLBytes/nTBytes)*100;
  mcLoader.mcBar._xscale = nPercent;
  var sPercent:String = Math.floor(nPercent).toString();
  var sKBytes:String = Math.floor(nTBytes/1024).toString();
  var sMessage:String = sPercent + % of  + sKBytes + K loaded.;
  mcLoader.tPercent.text = sMessage;
  if (nLBytes = nTBytes  nTBytes  0) {
if (nCount = 12) {
  clearInterval(nProgress);
  mcTarget.gotoAndPlay(main);
} else {
  nCount++;
}
  }
  updateAfterEvent();
}

var nCount:Number = 0;
var nProgress:Number = setInterval(checkLoad, 100, this);

stop;

--
count_schemula
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.15/581 - Release Date: 2006-12-09
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.15/581 - Release Date: 2006-12-09
 

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] preloader not completely preloading...

2006-12-11 Thread Steven Sacks | BLITZ
stop();
function checkLoad()
{
   var c = mc.getBytesLoaded();
   var t = mc.getBytesTotal();
   var p = (c / t) * 100;
   MC_LoaderBar._xscale = p;
   TXT_Load.text = Math.floor(p + %);
   if (p == 100  t  4) {
  delete this.onEnterFrame;
  mc.gotoAndPlay(main);
   }
}
this.onEnterFrame = checkLoad;


Doesn't get much simpler.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] preloader not completely preloading...

2006-12-11 Thread Count Schemula

Thanks everyone!

On 12/11/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:

stop();
function checkLoad()
{
   var c = mc.getBytesLoaded();
   var t = mc.getBytesTotal();
   var p = (c / t) * 100;
   MC_LoaderBar._xscale = p;
   TXT_Load.text = Math.floor(p + %);
   if (p == 100  t  4) {
  delete this.onEnterFrame;
  mc.gotoAndPlay(main);
   }
}
this.onEnterFrame = checkLoad;


Doesn't get much simpler.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
count_schemula
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com