PDA

View Full Version : Flash loader bar



Mehok
02-02-2007, 11:06 AM
I was in the process of making a loading bar of my own using somewhat same deign as the rep point display thini and i was using this code

ifFrameloaded("Main",1) {
gotoAndPlay("Main",10);
}

and it did not quite work

i was using 10 graphic sinbols each one is like 10 percent

can anyone give me a hand and make some samples and see if there is anything else I have to do

thanks

BLiZZaRD
02-02-2007, 02:58 PM
You want to use frame labels instead of scene names. It is actually an easier check point for Flash.

Here is one of the easiest, but most eye catching loaders to make:

First make your MCs.

1) Make an MC that has the text "Loading"

2) Make an MC that has the text "PLAY" (or done, or go, etc..)

3) Make a progress bar. This should be a plain nice bar with a color or fill gradient motion tweened from "empty" to "full" (masks work nice here too)

4)Put all these on your stage in 3 sequential frames. the loading text, bar and tweens on frame one and frame 2, play text on frame 3. Obviously, here we want to give the bar an instance name of "bar"

5) label frame 3 as "loaded"

6) in your actions layer on frame 2 put this:



gotoAndPlay(1);


7) in your actions layer on frame 1 put this:


PercentLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
gotoAndStop("loaded");
}


Then in your Play MC's actions you can put



on(release){
gotoAndPlay("10");
}


For an even simpler method:

2 frames. In the first make a dynamic text box with the var label "myOutput"

then in the actions layer put this:



var percent = Math.floor(getBytesLoaded()/getBytesTotal()*100);
var myOutput = _root.percent +"% is now Loaded";


In the 2nd frame make sure the dynamic text box is in the same spot as in the first, and put this in the actions layer:



if(percent == 100){
gotoAndPlay(10);
}
else{
gotoAndPlay (1);
}


This will make a text percentile ( 1% counting up to 100%) in the text box and when it reaches 100% it will go to frame 10, or which ever you need.

Mehok
02-05-2007, 02:42 PM
so there is a bit of java script involved what about just using the code and instead of getting info or going to another page i input geturl("http://www.whatever.com");

BLiZZaRD
02-06-2007, 10:32 PM
Yes you can tell it something like:



if(percent == 100){
gotoAndPlay(getURL("http://whatever.com", "_self"));
}
else{
gotoAndPlay (1);
}

corsocorso
07-08-2008, 05:42 AM
For an even simpler method:

2 frames. In the first make a dynamic text box with the var label "myOutput"

then in the actions layer put this:



var percent = Math.floor(getBytesLoaded()/getBytesTotal()*100);
var myOutput = _root.percent +"% is now Loaded";


In the 2nd frame make sure the dynamic text box is in the same spot as in the first, and put this in the actions layer:



if(percent == 100){
gotoAndPlay(10);
}
else{
gotoAndPlay (1);
}


This will make a text percentile ( 1% counting up to 100%) in the text box and when it reaches 100% it will go to frame 10, or which ever you need.

Hey! that loader was very useful! but i had some problems:
What i'm trying to load is a section from a website which has a scrolling text. Without the loader, the text works fine, but when I place the loader at another scene before the actual scrolling text, or at the same scene the text seems to disappear... if i move the loader scene after the text's scene the text works fine..
I would appreciate any solution for my problem.
Thanks a lot

Medyman
07-08-2008, 07:19 PM
Post your code and I'll take a look. It's hard to say anything from your description alone :D

corsocorso
07-08-2008, 07:27 PM
the loader's code is the second choice given by Blizzard.

the scrolling text is:

down_btn.onPress = function() {
textField_txt.scroll += 1;
};
up_btn.onPress = function() {
textField_txt.scroll -= 1;
};
stop();

Thnx a lot

corsocorso
07-10-2008, 04:22 AM
well.. I fixed it.. the problem was that the dynamic text at the loader wasn't embedded... and i don't know why it affects the scrolling text that was embedded.. but anyway.. it worked xD