AS3 Loading

here is a step by step procedure to add a loading to a as3 flash.
1) Keep first frame clean to add loading to first frame.




2) create load_mc movieclip on first frame with 100 frame of loading animation. and a dynamic textbox inside load_mc named percent_txt;




3) give an instance name to load_mc - "load_mc"
4) finally add the following script to first frame of your flash document.


----------------------------------------------------------------------------------
stop();

var timer:Timer=new Timer(10);
timer.addEventListener(TimerEvent.TIMER,loading);
timer.start();

function loading(evt:Event)
{
var loaded=root.loaderInfo.bytesLoaded;
var total=root.loaderInfo.bytesTotal;

var percent=Math.ceil((loaded/total)*100);
load_mc.percent_txt.text=percent+"%";
load_mc.gotoAndStop(percent);
if(loaded>=total)
{
timer.stop();
gotoAndStop(2);
}
}

-----------------------------------------------------------------------------------

download FLA file

No comments:

Post a Comment

 
Home | Gallery | Tutorials | Freebies | About Us | Contact Us

Copyright © 2009 IpixDesigners |Designed by Templatemo |Converted to blogger by BloggerThemes.Net

Usage Rights

DesignBlog BloggerTheme comes under a Creative Commons License.This template is free of charge to create a personal blog.You can make changes to the templates to suit your needs.But You must keep the footer links Intact.