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
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”.
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");
}
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?
thanks man… it worked… if you wanna see what Im messing around with you can go to this link… 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