Preload « Actionscript Programming « Flash Tutorials

Home
Flash Tutorials
1.Actionscript Programming
2.Animals
3.Animation
4.Colors
5.Design
6.Effects
7.Game Cartoon
8.Humans
9.Models
10.Nature
11.Operations
12.Shapes
Photoshop Tutorials
Maya Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
Flash Tutorials » Actionscript Programming » Preload 

In frame 2 in actions layer hit F7 to insert a blank keyframe after hit F9 to open the ActionScript panel and paste the code: stop();

find size of published movie, find size of each frame in movie, see how movie looks at different connection speeds, add 100-frame preloader to beginning of movie

In frame 1 type the following code:

First off, create a new actionscript 2 file, set the framerate to 30 and rename the first layer ?loader?. Create two new layers, one called actions the other called frames.

Source file here

We will be developing this Flash MX file: loader.fla (35kb).

I then selected the progress bar and hit F8 to make it a movie clip. Make sure the registration point is set like the following. Why? Because we want the progress bar to fill from left to right!

A preloader is a simple animation that is played while the rest of a movie is being downloaded. The animation is made attractive to keep the viewer occupied?especially if the size of the swf. file is substantial.

Maa Graphics Services

Maa Graphics Services

Our preloader code is going to retrieve the amount of data which has loaded and compare it with the total file size of our SWF. This preloader code will have to be repeatedly checked until the movie stops loading. To make our code repeatedly execute we will create an event listener that we will attach to the main timeline and then call a loading function using that listener. The ENTER_FRAME event is executed repeatedly in accordance with the frame rate specified for the Flash movie.

Use the color mixer to apply "Linear" color to your button if you like.

once you have done that double click on the Move(40) action and set the setting seen in fig.9b below.

I used 2 layers one for the border and one for the center, but you don't need to,

First make 4 layers!

Select the Rectangle tool (R) and block the Outline color. Draw a 150 by 5 pixel rectangle and center it on stage. I suggest that you adjust these values by entering them in the appropriate fields in the Properties panel. You?ll find the width (W) and height (H) input fields in the bottom left part of the aforementioned panel.

In this tutorial you will learn how to create a preloader that will return a percentage. This percentage can then be used for things such as a preloader bar. Preloaders that work out percentages are important because they give the users of your site feedback of how much of your flash content is loaded. For this tutorial I expect you to have a basic knowledge of flash and can navigate around freely within the flash interface. I also expect you to have a basic actionscripting knowledge and be able to understand the basic scripts in this tutorial. This tutorial has been writen for use in Flash MX, it takes advantage of some of the added features including text box instance names. If you don't have mx, remember to use the textVariable property instead of the instance name.

NOTE: The preloader will display only when the animation takes some time to load. This happens only when you download the flash animation over the internet connection and only for the first time. When you view the file locally (for example when you press "Play Animation") the preloader doesn't appear because the animation loads at once, and the preloader has no chance to start showing the progress.

The fla I made available [coming soon in the flash downloads section] has an added Scene that I did not tell you to add. This Scene Was added to allow for the movie to load. Otherwise it would load to quick and not have been able to view when tested. I placed a few Images and text in the Second scene to add to the size of the file. After adding a new scene with some images the next thing to do is Test the Movie. When testing the Movie, Go to View > Show Streaming. this Starts the movie over and simulates the movie loading as if it were being downloaded.

Generally to make A Flash Movie or a so called flash site you need to have knowledge in the most basic parts such as interface design, symbols, and the most important part, the preloaders.

Create a new document in Flash. Select Modify > Document (shortcut key: Ctrl+J ). Select white as background color and click ok.

The next step is to insert 2 blank keyframes at the start of the timeline (before any of the 'main' movie frames are visible. Next, add two more layers to the timeline. One of these is for the preloader actions (the scripting) and the other is for the percentage display. In the Percentage layer, put a text field. Make this editable by clicking on the 'ab|' button in the tool palette. Then edit the properties of the text field, using the settings shown below, giving it the name 'Percentage'. Note that I've only included font outlines for numbers and the % symbol, because that's all we need. You might also want to un-check the 'Draw border and background' option.

Create a dynamic text box above the preloader line and give it a var name of: "loadpercent". (case sensitive no quotes)

In this tutorial you will learn how to create a preloader that will return a percentage. This percentage can then be used for things such as a preloader bar. Preloaders that work out percentages are important because they give the users of your site feedback of how much of your flash content is loaded. For this tutorial I expect you to have a basic knowledge of flash and can navigate around freely within the flash interface. I also expect you to have a basic actionscripting knowledge and be able to understand the basic scripts in this tutorial. This tutorial has been writen for use in Flash MX, it takes advantage of some of the added features including text box instance names. If you don't have mx, remember to use the textVariable property instead of the instance name.

In flash, go to modify>>scenes. Click on the plus sign, or the new scene button. Rename the scenes preloader and scene.

Making a preloader is a common topic for tutorials, but here's a new twist: download rate/remaining time. It'll look something like this:

This tutorial demonstrates how to create a percentage preloder for .jpeg file loaded in your movie from an externally .jpeg file.

Line 2: TOTAL = Math.round(getBytesTotal()); Finds the total file size in Bytes and rounds this number off into a whole number .

Create a new actionscript 2 file, change the framerate to 30 and rename layer 1 to ?stuff?. First off we will draw our loading bar. Select the rectangle tool and set the fill colour to your liking, with an outline of an alternative colour (black / dark grey recommended!). Select all of this shape and press f8 to convert to a movie clip called MC_loadBar. Give this an instance name of MC_loadBar.

In This tutorial I'm going to show you how to make a simple preloader and since this is a preloader I then decided to include an invisible content which equivalent to 1mb, this is for the sake of previewing the preloader.

The code above would be a class file for a MovieClip that contains another MovieClip called loadProg_MC that acts as a mask for some kind of load bar (in my example it's unmasking the glow behind the words “Click Pop Media”). The MovieClip would also have a TextField called output_TF to display the % loaded.

How to convert FLV to 3GP for free? Last post by: desertfish Date: 12.10.2009 07:41:08

How to convert FLV to 3GP for free? Last post by: desertfish Date: 12.10.2009 07:41:08

w___ww_.j_ava2__s_.com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.