# I need help with some preloader actionscript

**URL:** <https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419>\
**Category:** flash\
**Created:** [July 31, 2004, 6:26am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419 "2004-07-31T06:26:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![unreFINEdARTist](https://avatars.discourse-cdn.com/v4/letter/u/34f0e0/32.png) [@unreFINEdARTist](https://forum.kirupa.com/u/unreFINEdARTist)\
**Post date:** [July 31, 2004, 6:26am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/1 "2004-07-31T06:26:04Z")

</div>

I am trying to do the flash mx pro 2004 bible’s tutorial of how to build a preloader and I ran into some trouble… heres the actionscript I enetered…  
var 1Bytes = this.getBytesLoaded();  
var TBytes = this.getBytesTotal();  
var percentLoaded = Math.floor((1Bytes/tBytes)\*100);  
loader\_mc.bar\_mc.\_xscale = percentLoaded;  
loader\_mc.percent = percentLoaded + "% of " + Math.floor(tBytes/1024) + “K loaded.”;  
if (1Bytes \>= tBytes && tBytes \> 0) {  
if (count\>12) {  
gotoAndStop(“main”);  
} else {  
count++;  
}  
} else {  
gotoAndPlay(“preload”);  
}

when I go to publish this the following errors occur…  
**Error** Scene=Scene 1, layer=actions, frame=3:Line 1: Identifier expected  
var 1Bytes = this.getBytesLoaded();  
**Error** Scene=Scene 1, layer=actions, frame=3:Line 3: ‘)’ expected  
var percentLoaded = Math.floor((1Bytes/tBytes)\*100);  
Total ActionScript Errors: 2 Reported Errors: 2

Im a noob so this doesnt mean much to me yet, what should I do to make it work? thanks. -UA

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 6:44am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/2 "2004-07-31T06:44:17Z")

</div>

The name of a variable/object/function/etc. may not start with a number (well, at least not by _conventional_ means ;)). I think you’ve misread the book and it should be “l” (lowercase L) instead of “1”. 🙂

```auto
var lBytes = this.getBytesLoaded();
var tBytes = this.getBytesTotal();
var percentLoaded = Math.floor((lBytes/tBytes)*100);
loader_mc.bar_mc._xscale = percentLoaded;
loader_mc.percent = percentLoaded+"% of "+Math.floor(tBytes/1024)+"K loaded.";
if (lBytes>=tBytes && tBytes>0) {
	if (count>12) {
		gotoAndStop("main");
	} else {
		count++;
	}
} else {
	gotoAndPlay("preload");
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 6:55am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/3 "2004-07-31T06:55:22Z")

</div>

thanks, that was the problem, yet still it doesnt work. when I test the movie it just pauses on the first frame… the preloader doesnt do anything… raaaaaaaaaaa! this is frustrating… helP?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 7:06am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/4 "2004-07-31T07:06:09Z")

</div>

Was the variable “count” properly defined? Try this one:

```auto
if (!count) var count = 1;
var lBytes = this.getBytesLoaded();
var tBytes = this.getBytesTotal();
var percentLoaded = Math.floor((lBytes/tBytes)*100);
loader_mc.bar_mc._xscale = percentLoaded;
loader_mc.percent = percentLoaded+"% of "+Math.floor(tBytes/1024)+"K loaded.";
if (lBytes>=tBytes && tBytes>0) {
	if (count>12) {
		gotoAndStop("main");
	} else {
		count++;
	}
} else {
	gotoAndPlay("preload");
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 7:59am UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/5 "2004-07-31T07:59:20Z")

</div>

thanks man… it worked… if you wanna see what Im messing around with you can go to this link… [www.unrefinedartists.com/trial.htm](http://www.unrefinedartists.com/trial.htm) … I just started trying harder things in flash two days ago, the site that loads when you click the “enter” button isnt mine though, just a companies. thanks again mang. -UA

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 4:58pm UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/6 "2004-07-31T16:58:14Z")

</div>

You’re welcome. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 8:12pm UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/7 "2004-07-31T20:12:42Z")

</div>

that site isnt bad. One thing i would recommend is to edit the text so that it doesnt appear choppy and blurry.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 8:18pm UTC](https://forum.kirupa.com/t/i-need-help-with-some-preloader-actionscript/59419/8 "2004-07-31T20:18:30Z")

</div>

turn off audio choice in intro and first page, and allow to skip intro, then it’d be pretty cool 🙂
