The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.

ForumsProgramming Forumneed help with load bar

19 10213
ever388
offline
ever388
17 posts
Nomad

hi,
i need help to make a loader. i have macromedia flash 8 with actionscript 2 and every time i makee a loader it fails

  • 19 Replies
cormyn
offline
cormyn
2,891 posts
Nomad

Moving this to the Flash forum.

Darkroot
offline
Darkroot
2,763 posts
Peasant

How about you post your code and we can try to tell you were you went wrong?

ever388
offline
ever388
17 posts
Nomad

this was the code i used:
var barWidth:Number = 200;
var barHeight:Number = 6;

this.createEmptyMovieClip(&quotBar_mc", 9999);
var bar:MovieClip = pBar_mc.createEmptyMovieClip("bar_mc", 10);
bar.beginFill(0xFF0000, 100);
bar.moveTo(0, 0);
bar.lineTo(barWidth, 0);
bar.lineTo(barWidth, barHeight);
bar.lineTo(0, barHeight);
bar.lineTo(0, 0);
bar.endFill();
bar._xscale = 0;

var stroke:MovieClip = pBar_mc.createEmptyMovieClip("stroke_mc", 20);
stroke.lineStyle(0, 0x000000);
stroke.moveTo(0, 0);
stroke.lineTo(barWidth, 0);
stroke.lineTo(barWidth, barHeight);
stroke.lineTo(0, barHeight);
stroke.lineTo(0, 0);

pBar_mc.createTextField("label_txt", 30, 0, barHeight, 100, 21);
pBar_mc.label_txt.autoSize = "left";
pBar_mc.label_txt.selectable = false;

pBar_mc._x = (Stage.width - pBar_mc._width) / 2;
pBar_mc._y = (Stage.height - pBar_mc._height) / 2;

var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success:Boolean) {
pBar_mc.onEnterFrame = undefined;
if (success) {
trace("XML loaded successfully"
} else {
trace("Unable to load XML"
}
};
my_xml.load("http://www.helpexamples.com/flash/xml/ds.xml"

pBar_mc.onEnterFrame = function() {
var pctLoaded:Number = Math.floor(my_xml.getBytesLoaded() / my_xml.getBytesTotal() * 100);
if (!isNaN(pctLoaded)) {
pBar_mc.bar_mc._xscale = pctLoaded;
pBar_mc.label_txt.text = pctLoaded + "% loaded";
if (pctLoaded >= 100) {
pBar_mc.onEnterFrame = undefined;
}
}
};

ever388
offline
ever388
17 posts
Nomad

onClipEvent (load){
total = _root.getBytesTotal();
} onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
percen1 = ""+percent+"%";
gotoAndStop(percent);
_root.mc_progressbar._width = percent*3
if (loaded == total) {
_root.gotoAndPlay(100);
}
}

that is the one i got from the youtube video but it doesnt load it the number stays at 99% and the bar starts full up

ever388
offline
ever388
17 posts
Nomad

right in that video i think it should work and ive edited it to fix errors but one bit i cant work out

(__________)here it says i need an identifier but i dont know what to do{(load)total=_root.getBytesTotal();

onClipEvent (enterFrame) {
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
percen1 = ""+percent+"%"; gotoAndStop(percent);
_root.mc_progressbar._width = percent*3
if (loaded == total) {
_root.gotoAndPlay(2);

}

}

Darkroot
offline
Darkroot
2,763 posts
Peasant

Hmm on just a quick look it looks like your missing addEventListener on enter frame?

ever388
offline
ever388
17 posts
Nomad

no, still say syntax error

ever388
offline
ever388
17 posts
Nomad

help

Darkroot
offline
Darkroot
2,763 posts
Peasant

Ok let me tell you the truth, I want to help but, it's as2 and I don't think you know how to program. That discourages me since you're going to encounter more problems due to not learning the material you're using. Really one of the untold rules of programming forums are not copy/pasta help. You will find it much more fruitful to study actionscript than mash together copied code.

ever388
offline
ever388
17 posts
Nomad

ok i suppose that helps but i can make basic games like sniper games or maze games their pretty simple.

PixelSmash
offline
PixelSmash
566 posts
Nomad

I'd hate to burst your bubble... but for either of those types of games, you'll need more (and more complicated) code than letting a loaderbar fill up. Creating a game is hard, long and tedious work...

But, you can learn Ask questions, toy around, google, toy around again, google once more, ask some more questions... You'll get there

PixelSmash
offline
PixelSmash
566 posts
Nomad

To add to that... if you want to make flash games, start by learning AS3 It might be a bit more difficult than AS2, but the options you have, the coding ease, and processing power are a lot better. There's a reason AS3 is out for about 6 years already

ever388
offline
ever388
17 posts
Nomad

ok ive been trying to work out my load bar problem for at least half a year my google history is filled up with searches. and as for as3 cant find anywhere to download it for free. so can someone just solve my problem because i can make games.

one other thing where do i get the armor games logo?

Darkroot
offline
Darkroot
2,763 posts
Peasant

ok ive been trying to work out my load bar problem for at least half a year my google history is filled up with searches. and as for as3 cant find anywhere to download it for free.


For half a year, really? By that time you could have actually learned to program and not try to fix code you can't understand yet.

as3 cant find anywhere to download it for free. so can someone just solve my problem because i can make games.


As3 is a language thus free, I think you're referring to flash CS3-5 which you can't get for free. You can get Flash builder that lets you use as3 and export swf files.

one other thing where do i get the armor games logo?


Not really something you should be concerned about but I believe they give it to you after you submit your game and it's accepted. You probably get the API for their high score system too. But I not 100% sure.
Smokeshow
offline
Smokeshow
69 posts
Peasant

onClipEvent (load) { total = _root.getBytesTotal();

} onClipEvent (enterFrame) { loaded = _root.getBytesLoaded(); percent = int(loaded/total*100); percen1 = ""+percent+"%"; gotoAndStop(percent); _root.mc_progressbar._width = percent*3 if (loaded == total) { _root.gotoAndPlay(2);

}

}




LoL this is the code

Showing 1-15 of 19