Preloader
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
How do I make a preloader like the one in this game?
-
The Last Stand. by Con-ArtistsClick to view.
- Type
- Game
- Rated
- Ages 17+
I have the dynamic text box and number part finished, and I have it set to go to frame 2 when it's done loading.
I know that I have to make a 100 frame movie clip (I guess with a tweened mask slowly uncovering the bar) but what code do I use to make it move and uncover the bar?
- Callum123456
-
Callum123456
- Member since: Mar. 7, 2009
- Offline.
-
- Forum Stats
- Member
- Level 24
- Blank Slate
- Spysociety
-
Spysociety
- Member since: Dec. 30, 2009
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
The loading bar, do it a movie clip with registration in the left, do it a MC and give it instance name from loadingBar.
Now open a dynamic text field and give it instace name from percentDisplay and do it a MC and give it instance from percentClip.
Do a play button and give it instance from play_btn.
play_btn._visible = false;
// do your play button unvisible
loadingBar._xscale = 1;
// primary scale from your bar
var loadingCall:Number = setInterval(preloadGame, 50);
// Create a variable which will load your game
function preloadGame():Void {
// loop-end function to load your game
var gameLoaded:Number = _root.getBytesLoaded();
// create a variable which will count the bytes from your game
var gameTotal:Number = _root.getBytesTotal();
// this will takes the game total bytes
percentClip.percentDisplay.text = percentage + "%";
//your dynamic text inside the percentClip movie clip will show the percentage
if (gameLoaded >= gameTotal) {
//if your game loaded be more than game total
clearInterval(loadingCall);
// will clear the countdown
_root.play_btn._visible = true;
// will turn your play button visible
}
// ends statement
} // ends all functions
Hope this helps.
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
- Callum123456
-
Callum123456
- Member since: Mar. 7, 2009
- Offline.
-
- Forum Stats
- Member
- Level 24
- Blank Slate
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
At 10/11/10 08:10 PM, Callum123456 wrote:At 10/11/10 07:56 PM, Animator1mike wrote: Neither of those seem to work. I have Flash 8 As2, sorry if i didnt make that clear.What do you mean don't work? any errors?
also I just realized it should be.
bar.gotoAndStop(loadpercentage)
Your code doesn't seem complete. Where would I put that code anyway? In the main timeline? Or on the movie clip? (I tried both, giving the bar movie clip an instance name of "bar", neither of them worked)
- Spysociety
-
Spysociety
- Member since: Dec. 30, 2009
- Offline.
-
- Forum Stats
- Member
- Level 21
- Blank Slate
At 10/11/10 07:56 PM, Animator1mike wrote: Neither of those seem to work. I have Flash 8 As2, sorry if i didnt make that clear.
It is AS2 and always work. I use these codes in almost all my submissions. Have you sure you did everything correct. It is not you just forgetting to simulate download?
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
At 10/11/10 08:27 PM, Spysociety wrote:At 10/11/10 07:56 PM, Animator1mike wrote: Neither of those seem to work. I have Flash 8 As2, sorry if i didnt make that clear.It is AS2 and always work. I use these codes in almost all my submissions. Have you sure you did everything correct. It is not you just forgetting to simulate download?
Nope, I tested it out. The actual number works, and the play button works, but the bar isn't moving. it stays invisible. But I already have the number and play button, all i need to work is the bar.
- Callum123456
-
Callum123456
- Member since: Mar. 7, 2009
- Offline.
-
- Forum Stats
- Member
- Level 24
- Blank Slate
At 10/11/10 08:26 PM, Animator1mike wrote:At 10/11/10 08:10 PM, Callum123456 wrote:Your code doesn't seem complete. Where would I put that code anyway? In the main timeline? Or on the movie clip? (I tried both, giving the bar movie clip an instance name of "bar", neither of them worked)At 10/11/10 07:56 PM, Animator1mike wrote: Neither of those seem to work. I have Flash 8 As2, sorry if i didnt make that clear.What do you mean don't work? any errors?
also I just realized it should be.
bar.gotoAndStop(loadpercentage)
You said you have the number done. just use that number to set the frame of the movieclip. THis could go in the timeline.
onClipEvent(enterFrame){
var loadpercentage = //whatever you're using to get the load percentage
bar.gotoAndPlay(loadPercentage)
} - MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor


