00:00
00:00
Newgrounds Background Image Theme

PalmVoe just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss: Awesome Api Preloader

1,884 Views | 10 Replies
New Topic Respond to this Topic

Foss: Awesome Api Preloader 2005-09-03 10:56:14


onClipEvent (load) {
_root.createEmptyMovieClip("l1", 1);
_root.createEmptyMovieClip("l2", 2);
perc = "0%";
p1 = 0;
_root.stop();
}
onClipEvent (enterFrame) {
den = _root.getBytesTotal();
num = _root.getBytesLoaded();
p1 = (num/den)*100;
p2 = Math.round(p1);
perc = ""+p2+"%";
_root.l1.clear();
_root.l1.moveTo(275, 200);
_root.l1.lineStyle(2, 0xffffff, 100);
_root.l1.lineTo(_root._xmouse, _root._ymouse);
_root.l2.clear();
_root.l2.moveTo(275, 200);
_root.l2.lineStyle(15, 0xffffff, 100);
xd = _root._xmouse-275;
yd = _root._ymouse-200;
x = (xd*p1/100)+275;
y = (yd*p1/100)+200;
_root.l2.lineTo(x, y);
if (p1>=100) {
removeMovieClip(_root.l1)
removeMovieClip(_root.l2)
_root.play();
}
}

INSTRUCTIONS: Put that on a MC on the first frame of your movie. TADA! (Change colors around, meant to work on a non-white background)

It is the preloader used in White & Black

Response to Foss: Awesome Api Preloader 2005-09-03 10:57:31


Response to Foss: Awesome Api Preloader 2005-09-03 11:00:33


Nice, It's very simple and good. Easy to use too, for the newbies.


BBS Signature

Response to Foss: Awesome Api Preloader 2005-09-03 11:03:33


At 9/3/05 10:56 AM, Glaiel_Gamer wrote: It is the preloader used in White & Black

API preloaders, huh? This is something I've been meaning to do for a while. Give me 15 minutes to cook something up (probably more like an hour, but we can hope....)


- - Flash - Music - Images - -

BBS Signature

Response to Foss: Awesome Api Preloader 2005-09-03 11:04:14


At 9/3/05 11:03 AM, Denvish wrote: API preloaders, huh? This is something I've been meaning to do for a while. Give me 15 minutes to cook something up (probably more like an hour, but we can hope....)

This only took me 15 minutes.

Response to Foss: Awesome Api Preloader 2005-09-03 11:52:43


Here's a very basic one with a circle loading.

stop();
Stage.scaleMode = "showAll";
SW = Stage.width;
SH = Stage.height;
createEmptyMovieClip("back", 1);
with (back) {
beginFill(0, 100);
moveTo(0, 0);
lineTo(SW, 0);
lineTo(SW, SH);
lineTo(0, SH);
endFill();
}
createEmptyMovieClip("circle", 2);
circle.rd = SH/4;
circle.oA = 0;
with (circle) {
_rotation = 270;
_x = SW/2;
_y = SH/2;
}
onEnterFrame = function () {
circle.rp = (_root.getBytesLoaded()/ _root.getBytesTotal())*360;
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
back.removeMovieClip();
circle.removeMovieClip();
_root.gotoAndStop(2);
}
with (circle) {
beginFill(0x8F0101, 100);
am = Math.tan(22.5*Math.PI/180);
var startx = rd*Math.cos(oA*Math.PI/180);
var starty = rd*Math.sin(oA*Math.PI/180);
moveTo(0, 0);
lineTo(startx, starty);
var endx = rd*Math.cos(rp*Math.PI/180);
var endy = rd*Math.sin(rp*Math.PI/180);
lineTo(endx, endy);
lineTo(0, 0);
endFill();
oA = rp;
}
};


- - Flash - Music - Images - -

BBS Signature

Response to Foss: Awesome Api Preloader 2005-09-03 11:53:26


demo please

Response to Foss: Awesome Api Preloader 2005-09-03 12:32:43


At 9/3/05 11:53 AM, Glaiel_Gamer wrote: demo please

Fleshed it out a bit (added counter, button, fade), still needs work though. Drawing seems glitchy, too.
DEMO

stop();
Stage.scaleMode = "showAll";
SW = Stage.width;
SH = Stage.height;
aTF = new TextFormat();
with (aTF) {
color = 0xFE3301;
font = "Tahoma";
size = 12;
bold = 1;
align = "center";
}
createEmptyMovieClip("back", 1);
with (back) {
beginFill(0, 100);
moveTo(0, 0);
lineTo(SW, 0);
lineTo(SW, SH);
lineTo(0, SH);
endFill();
createEmptyMovieClip("circle", 2);
circle.rd = SH/4;
circle.oA = 0;
with (circle) {
_rotation = 270;
_x = SW/2;
_y = SH/2;
}
createEmptyMovieClip("butt", 3);
with (butt) {
beginFill(0, 0);
moveTo(-150, -150);
lineTo(150, -150);
lineTo(150, 150);
lineTo(-150, 150);
endFill();
createTextField("txt", 1, -150, -10, 300, 30);
txt.selectable = 0;
_x = SW/2;
_y = SH/2;
}
}
onEnterFrame = function () {
pc = (_root.getBytesLoaded()/_root.getBytesTota
l())*100;
back.circle.rp = int(pc*3.6);
back.butt.txt.text = int(pc)+"% LOADED";
back.butt.txt.setTextFormat(aTF);
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
back.butt.txt.text = "PLAY";
back.butt.txt.setTextFormat(aTF);
back.butt.onPress = function() {
this.txt._visible = 0;
ml = 1;
gotoAndStop(2);
};
}
if (!_root.ml) {
with (back.circle) {
if (rp>oA) {
beginFill(0x8F0101, 100);
am = Math.tan(22.5*Math.PI/180);
var startx = rd*Math.cos(oA*Math.PI/180);
var starty = rd*Math.sin(oA*Math.PI/180);
moveTo(0, 0);
lineTo(startx, starty);
var endx = rd*Math.cos(rp*Math.PI/180);
var endy = rd*Math.sin(rp*Math.PI/180);
var cx = endx+rd*am*Math.cos((rp-90)*Math.PI/180);
var cy = endy+rd*am*Math.sin((rp-90)*Math.PI/180);
curveTo(cx, cy, endx, endy);
lineTo(0, 0);
endFill();
oA = rp;
}
}
} else {
back._alpha -= 5;
back._alpha<5 ? back.removeMovieClip() : null;
}
};


- - Flash - Music - Images - -

BBS Signature

Response to Foss: Awesome Api Preloader 2005-09-03 12:34:38


At 9/3/05 12:32 PM, Denvish wrote: DEMO

Hmmm, doesn't look too good if you already have the movie in your cache. Oh well.


- - Flash - Music - Images - -

BBS Signature

Response to Foss: Awesome Api Preloader 2005-09-03 12:39:53


we are stepping on the shoulders of giants

http://members.shaw...ar/AS-Preloader.html

schorhr.

http://members.shaw...war/AS-Preloader.txt
the code.

Response to Foss: Awesome Api Preloader 2005-09-03 12:46:27


At 9/3/05 12:39 PM, Inglor wrote: schorhr.

Yeah, but I made the music in mine =)


- - Flash - Music - Images - -

BBS Signature