Go Back   The Clock Crew
Register FAQ Members List Search Today's Posts Mark Forums Read

Tutorials:flash:actionscript:custom_preloader
Home   Backlinks   15 Views   Index   Random  
   

Custom Preloader


By Roman Clock

–Compatable: MX, MX 2004, Flash 8–

1. First, create a movieclip and name it whatever you want. We will call it “loader”. Make 3 layers that are all 3 frames long. The top layer should be all keyframes and the 3rd frame on the other layers should be keyframes.

2. Now create one (1) movieclip on the lowest layer and a dynamic_text_box on the middle layer.

  • Name the movieclip whaterver you want, but give it the instance name of “loadBar”. It should be about a 20 by 20 pixel shape.
  • The dynamic_text_box has a box in the lower right corner called “Var:”, type “loaded” there.

3. Put this code on the top layer second frame: gotoAndPlay(1); Put this code on the top layer third frame: stop();

Put this on the top layer first frame:

_root.stop()
bytesL = _root.getBytesLoaded
bytesT = _root.getBytesTotal
KBL = _root.getBytesLoaded/1024
KBT _root.getBytesLoaded/1024
doneCheck = (KBL/KBT)*100

Put ONE of these codes on the top layer first frame below the previous code:

//Use this code to measure in BYTES
loaded = bytesL + "/" + bytesT
//Use this code to measure in KILOBYTES
loaded = KBL + "/" + KBT
//Use this code to measure PERCENT DONE
loaded = (KBL/KBT)*100 + "%"
//Use this code to measure PERCENT LEFT
loaded = 100-((KBL/KBT)*100) + "%"

Now put one of these codes on the top layer first frame below the previous code:

//Use this code to make the bar GROW HORIZONTALLY
loadBar._width = (KBL/KBT)*100
//Use this code to make the bar SHRINK HORIZONTALLY
loadBar._width = 100-((KBL/KBT)*100)
//Use this code to make the bar GROW VERTICALLY
loadBar._height = (KBL/KBT)*100
//Use this code to make the bar SHRINK VERTICALLY
loadBar._height = 100-((KBL/KBT)*100)
//Use this code to make the bar GROW
loadBar._height = (KBL/KBT)*100
loadBar._width = loadBar._height
//Use this code to make the bar SHINRK
loadBar._height = 100-((KBL/KBT)*100)
loadBar._width = loadBar._height

Put this code on the very bottom of the others:

if(doneCheck == 100){
  gotoAndStop(3);
}

4. Now on the last frame of any layer may a button, it is the PLAY button. Put this code on it: on(release){ _root.play(); }

5. You are finished! Test it to make sure, if there are any problems notifiy me: kul_dg@yahoo.com. You can click HERE to go back.





  • Need more help? Post your questions HERE!!!

 

Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.