Tutorials Navigation
How to Make a Loading Screen in Flash
Tutorial Name: How to Make a Loading Screen in Flash
Category: PC Tutorials
Submitted By: Ry-Nasty
Date Added:
Comments: 0
Views: 2,763
Related Forum: PC Building Forum
Share:
1
Create a new ActionScript 2.x file and change the fps to 50.
2
Create the movieclips required for your loading animation. We're going to create a very simple screen to start with.
Select the Rectangle tool from the Tools bar. Draw a rectangle about 10px high and 100px long and make it a movieclip (F8). This will be the bar that represents the amount of your movie that has loaded. In the Properties tab of the object, give this movieclip the instance name "progressBar".
Draw a textarea on the stage that will hold the percentage of the movie that has loaded.When creating the textarea, make sure that the Type dropdown (near the top of the Properties tab ) is set to Dynamic Text. Also in the Properties tab, click Character Embedding and select both "Numerals" and "Punctuation". (Tip: Hold down Ctrl while clicking to select multiple menu items.)Once created, give this textarea the instance name "percentageLoaded". Note: Do not make the textarea a symbol.
3
Write the ActionScript required to check how much of your movie is loaded. If you've used the Actions window before, it may already be visible to you. If not, press F9 or use the menu Window>Actions.
Create a new layer in the timeline for only your ActionScript. You can use the New Layer icon below the timeline or the menu Insert>Timeline>Layer. This will keep your ActionScript separate and clear of movieclips and makes life much easier when you have hundreds of layers or movieclips.
Add the following code to the Actions frame. Read the comments in the code (marked with //) to see what each part does.
Create a new ActionScript 2.x file and change the fps to 50.
2
Create the movieclips required for your loading animation. We're going to create a very simple screen to start with.
Select the Rectangle tool from the Tools bar. Draw a rectangle about 10px high and 100px long and make it a movieclip (F8). This will be the bar that represents the amount of your movie that has loaded. In the Properties tab of the object, give this movieclip the instance name "progressBar".
Draw a textarea on the stage that will hold the percentage of the movie that has loaded.When creating the textarea, make sure that the Type dropdown (near the top of the Properties tab ) is set to Dynamic Text. Also in the Properties tab, click Character Embedding and select both "Numerals" and "Punctuation". (Tip: Hold down Ctrl while clicking to select multiple menu items.)Once created, give this textarea the instance name "percentageLoaded". Note: Do not make the textarea a symbol.
3
Write the ActionScript required to check how much of your movie is loaded. If you've used the Actions window before, it may already be visible to you. If not, press F9 or use the menu Window>Actions.
Create a new layer in the timeline for only your ActionScript. You can use the New Layer icon below the timeline or the menu Insert>Timeline>Layer. This will keep your ActionScript separate and clear of movieclips and makes life much easier when you have hundreds of layers or movieclips.
Add the following code to the Actions frame. Read the comments in the code (marked with //) to see what each part does.
// Stops the playhead from moving down the timeline until you have finished loading your movie
stop();
// onEnterFrame starts a loop at the same speed that your movie fps is set to.
// it will continue indefinitely until you stop it.
_root.onEnterFrame = function(){
// Calculate the percentage of the movie that has loaded.
percentage = Math.round((this.getBytesLoaded()/this.getBytesTotal())*100);
// Set the x-axis or horizontal scale of the progressBar to visually
// represent the percentage. Note: To make this more visually
// effective, you will probably want to add a border.
progressBar._xscale = percentage;
// Put the percentage loaded into the textarea, e.g. "47%"
percentageLoaded.text = percentage + "%";
// Check if the percentage variable is equal to 100
if(percentage==100){
// remove the onEnterFrame loop we started above
delete _root.onEnterFrame;
// go and start your movie
gotoAndPlay("MovieStart");
}
}
Test your movie by pressing Ctrl+Enter or use the menu Control>Test Movie
Hope this helps.
Nasty
Hope this helps.
Nasty
Ratings
Comments
Related Tutorials
- 01. Emulating Xbox 360 on PC for Running COD4 With Mods(3,492)
- 02. How to: Matrix Numbers | Batch File(1,903)
- 03. How to Password Protect Files on Windows(857)
- 04. How to play Socom 2/3/ and Combined Assault on PC(6,716)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(6,133)
- 06. How to embed an image on TheTechGame(3,098)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(12,981)
- 08. Host bot lobbies! Full Tutorial!(11,243)
- 09. Unban yourself [Plutonium BO2](14,240)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(8,385)
- 11. Best Crosshair Settings for Valorant(6,525)
- 12. Othercide The Surgeon Boss Guide(2,539)
- 13. Othercide Remembrances Unlock Guide(4,460)
- 14. Othercide Beginners Tips and Tricks(2,708)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,845)
"How to Make a Loading Screen in Flash" :: Login/Create an Account :: 0 comments