PreLoader - ActionScript

Greetings.

I know there are many ways to program a preloaded. I just happened to choose the most difficult for a person just learning actionscript. I used the tutorial from netmag.co.uk and am receiving 4 errors on output - unexpected “if” encountered, unexpected “else” encountered, Line 14: ‘)’ or ‘,’ expected and ine 15: Syntax error.

Here is the script in question -

//find out how much data has loaded
count=int(_root.getBytesLoaded()/1024)+“KB”;
total=int(_root.getBytesTotal()/1024)+“KB”;
percentage=int(_root.getBytesLoaded()/_root.getBytesTotal()*100+"%",
status=“Loading…”,
//set the x scale of the loadbar
loadbar_size=int(_root.getBytesLoaded()/_root.getBytesTotal()*100),
setProperty(“loadbar”,_xscale,loadbar_size),
//check if all data is loaded
if(_root.getBytesLoaded()=_root.getBytesTotal()) {gotoAndPlay(“darksite”),
else {
percentage=“100%”,
status = “Loaded”,
setProperty("loadbar, _xscale, “100”),
gotoAndPlay (“darksite”,1);
}
Any help is much appreciated.

Thanks,
ChaoticGood.

Ok, managed to clear up the Line 14 error and the sytax error on Line 15. Still having trouble with the “unexpected ‘if’” and “unexpected ‘else’” errors.

Any help is greatly appreciated.

Best,
CG

OK, i’m realy nuub to AS, but i’ve “cleaned up” some of it… but i still get

[COLOR=Red]Error Scene=Scene 1, layer=AS, frame=1:Line 14: Property name expected in GetProperty.
setProperty(“loadbar”,"_xscale",“100”);[/COLOR]

count=int(_root.getBytesLoaded()/1024)+“KB”;
total=int(_root.getBytesTotal()/1024)+“KB”;
percentage=int(_root.getBytesLoaded()/_root.getBytesTotal())*100+"%";
status=“Loading…”;
//set the x scale of the loadbar
loadbar_size=int(_root.getBytesLoaded()/_root.getBytesTotal()*100);
setProperty(“loadbar”,_xscale,loadbar_size);
//check if all data is loaded
if(_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndPlay(“darksite”);
} else {
percentage=“100%”;
status = “Loaded”;
setProperty(“loadbar”,"_xscale",“100”);
gotoAndPlay (“darksite”,“1”);
}

dunno if this helps… :h: … but i thought i’d give it a shoot :blush:

Try changing this…


setProperty("loadbar",_xscale,loadbar_size);

To this…


setProperty("**_root.**loadbar",_xscale,loadbar_size);

If it still doesn’t work and you get really fed up, you can put "_root."s in front of everything! This is the main thing that causes a lot of problems in Flash–forgetting "_root"s and not referring to the appropriate timeline etc.

Thanks gents. I will try both of your suggestions tomorrow when I get to work.

Best,
CG