padnpen
07-03-2003, 03:33 AM
I'll give you the punch line, I'm not NEARLY as good as you are... you win. However, I was working on a preloader and wondered what magical creations others might come up with to put mine to shame. So... the challenge is to create a preloader that is better than mine (won't take much) in as many or fewer lines than mine. After seeing what has been done in 25 lines I don't think that will be a problem.
I tried to follow the rules of the challenges, at least in spirit. The only thing you need is a really large movie, which you should have one laying around somewhere, to test with. OK, here are my 32 lines of code... eager to be demolished!
createBar = function (amount) {
createEmptyMovieClip("myText", 97);
with (myText) {
createTextField("preText", 98, 198, 155, 300, 100);
preText.text = percent+"% is loaded";}
createEmptyMovieClip("bar", 99);
with (bar) {
beginFill(0xff0000, percent);
lineStyle(1, 0x000000, 100);
moveTo(200, -50);
lineTo(206, -55);
lineTo(206, 0);
lineTo(200, 0);
lineTo(200, -50);
endFill();}
bar._visible = false;
for (i=0; i<amount; ++i) {
duplicateMovieClip("bar", "bar"+i, i);
setProperty("bar"+i, _y, 150);
setProperty("bar"+i, _x, i*8);
setProperty("bar"+i, _yscale, (i+1)*6);}};
onEnterFrame = function() {
percent = Math.round(getBytesLoaded()/getBytesTotal()*100);
if (percent == 100) {
for (i=0; i<Math.round(percent/10); ++i) {
removeMovieClip("bar"+i);
}
removeMovieClip("bar");
removeMovieClip("myText");
gotoAndStop(2);
} else {
createBar(Math.round(percent/10));}};
If this is a stupid idea I will officially boot myself from any further proceedings.
I tried to follow the rules of the challenges, at least in spirit. The only thing you need is a really large movie, which you should have one laying around somewhere, to test with. OK, here are my 32 lines of code... eager to be demolished!
createBar = function (amount) {
createEmptyMovieClip("myText", 97);
with (myText) {
createTextField("preText", 98, 198, 155, 300, 100);
preText.text = percent+"% is loaded";}
createEmptyMovieClip("bar", 99);
with (bar) {
beginFill(0xff0000, percent);
lineStyle(1, 0x000000, 100);
moveTo(200, -50);
lineTo(206, -55);
lineTo(206, 0);
lineTo(200, 0);
lineTo(200, -50);
endFill();}
bar._visible = false;
for (i=0; i<amount; ++i) {
duplicateMovieClip("bar", "bar"+i, i);
setProperty("bar"+i, _y, 150);
setProperty("bar"+i, _x, i*8);
setProperty("bar"+i, _yscale, (i+1)*6);}};
onEnterFrame = function() {
percent = Math.round(getBytesLoaded()/getBytesTotal()*100);
if (percent == 100) {
for (i=0; i<Math.round(percent/10); ++i) {
removeMovieClip("bar"+i);
}
removeMovieClip("bar");
removeMovieClip("myText");
gotoAndStop(2);
} else {
createBar(Math.round(percent/10));}};
If this is a stupid idea I will officially boot myself from any further proceedings.