Be a Supporter!

Preloader

  • 295 Views
  • 9 Replies
New Topic Respond to this Topic
MichaelJ
MichaelJ
  • Member since: Mar. 2, 2009
  • Offline.
Forum Stats
Member
Level 18
Voice Actor
Preloader 2010-10-11 19:02:08 Reply

How do I make a preloader like the one in this game?

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?


BBS Signature
Callum123456
Callum123456
  • Member since: Mar. 7, 2009
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Preloader 2010-10-11 19:05:29 Reply

You can just do it like this.

bar.gotoAndPlay(loadPercentage)
Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Preloader 2010-10-11 19:34:28 Reply

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
Response to Preloader 2010-10-11 19:56:13 Reply

Neither of those seem to work. I have Flash 8 As2, sorry if i didnt make that clear.


BBS Signature
Callum123456
Callum123456
  • Member since: Mar. 7, 2009
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Preloader 2010-10-11 20:10:31 Reply

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)
MichaelJ
MichaelJ
  • Member since: Mar. 2, 2009
  • Offline.
Forum Stats
Member
Level 18
Voice Actor
Response to Preloader 2010-10-11 20:26:26 Reply

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)


BBS Signature
Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to Preloader 2010-10-11 20:27:44 Reply

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
Response to Preloader 2010-10-11 20:37:12 Reply

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.


BBS Signature
Callum123456
Callum123456
  • Member since: Mar. 7, 2009
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Preloader 2010-10-11 20:42:30 Reply

At 10/11/10 08:26 PM, Animator1mike wrote:
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)

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
Response to Preloader 2010-10-11 20:52:31 Reply

Thanks for the help.


BBS Signature