Posted By

chrisaiv on 02/08/08


Tagged

as3


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Who likes this?

8 people have marked this snippet as a favorite

outbox
visuallyspun
jmontanino
SmpleJohn
THEPWN3R
enajenkins
aesthetics
loric


AS3: Custom Preloader


Published in: ActionScript 3 






Create a 100 frame MovieClip animation in companion with this code to create a preloader. Place the rest of your Flash application on the following Scene or Frame

Expand | Embed | Plain Text
  1. /***************************
  2. Event Handler
  3. ***************************/
  4. addEventListener(Event.ENTER_FRAME, loading);
  5.  
  6. /***************************
  7. Function
  8. ***************************/
  9. function loading(e:Event)
  10. {
  11. var bytestotal = stage.loaderInfo.bytesTotal;
  12. var bytesloaded = stage.loaderInfo.bytesLoaded;
  13. var percent = Math.round(bytesloaded * 100/bytestotal);
  14.  
  15. mc_with_100_frame_animation.gotoAndPlay(percent);
  16.  
  17. if (bytesloaded >= bytestotal)
  18. {
  19. gotoAndStop(2);
  20. removeEventListener(Event.ENTER_FRAME, loading);
  21. removeChild(custom_animation);
  22. }
  23. }
  24. stop();

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: Slugtaco on April 14, 2009

Is the "customanimation" referring to the "mcwith100frame_animation"?

I received this error when trying it.

1120: Access of undefined property custom_animation.

Posted By: chrisaiv on April 24, 2009

Your custom animation is a 100 Frame MovieClip with, in this case, an instance name of "mcwith100frameanmiation"

You need to login to post a comment.

Download royalty free graphics