Draw circle preloader


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //draw circle line for the preloader
  2. var cos:Function=Math.cos;
  3. var sin:Function=Math.sin;
  4. var pi:Number=Math.PI;
  5. var d_r:Number=pi/180;
  6. var r_d:Number=180/pi;
  7. var midPoint:Object={_x:0,_y:0};
  8. var r:Number=11;
  9.  
  10. var pLoaded=Math.round(event.target.bytesLoaded*100/event.target.bytesTotal);
  11.  
  12. mcPreloader.graphics.clear();
  13. mcPreloader.graphics.lineStyle(3);
  14. mcPreloader.graphics.moveTo(11,0);
  15.  
  16. for (var z = 0; z<=pLoaded*3.6; z++) {
  17. mcPreloader.graphics.lineTo((cos(z*d_r)*r), (sin(z*d_r)*r));
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.