• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter II-3. Development > Flash Initial Code

Flash Initial Code

Progress Bar

The next thing the Vshift Flash team wanted to do was create a progress bar for the application (useful for users with a slow Internet connection to indicate when the application is done loading). Luckily, with Flash MX, a progress bar is available from the Flash UI Component Set 2. To use the component, the team simply dragged the component over to the Objects layer of the first frame on the main timeline and gave the component instance the name progressComponent. Then all they needed to do was add some ActionScript to the Actions layer of that same frame:

//setprogressbartotrackthe_rootobject 
progressComponent.setLoadTarget(_root);
//everytimethebarupdatesitcallsonProgress
progressComponent.setChangeHandler("onProgress");
//runseverytimetheprogressbarupdates
functiononProgress(){
//whenitgetsto100%movethestatetoLogin
if(progressComponent.getPercentComplete()==100){
gotoAndPlay("Login");
}
}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint