Flash CS3, CS4 Tutorial, Preloader
72Flash CS4 Tutorials
Links to Some Great Flash CS4 Tutorials and Flash Games
- IT Admin
IT Admin is you home for all computer related issues. Stop by and check out what is going on in the it world from a real it professional. - Flash CS4 Tutorials
Adobe Flash CS4 And CS3, The Information you really need is a website and ebook deidcated to provideing quality Flash CS4 Tutorials. - Flash CS3 Tutorials
Gordon French is a Flash Developer. You have found His Free Flash CS3 Tutorials - Flash CS4 Tutorial, Preloader
ActionScript 3.0 Tutorial on how to make preloader.
Flash CS4 Tutorial on making a PreLoader
Users hate to wait, and there is a good chance the will leave your site without every actually seeing your hard work if your site takes to long to load. In this Flash CS4 Tutorial, I am going to show you how to make a Preloader using ActionScript 3.0. A Flash CS4 Preloader will tell users to be patient the site as working and will finish loading soon. A Flash CS4 Preloader is reassuring to the user, where as a blank white screen is scary. Often a user will feel that a blank white screen means that a site is broken. And why should a user wait for a broken site if they can just go somewhere else. The trick to keep the user from leaving is to simply use actionscript to create a short, simple, fast loading, animation that entertains the user. ActionScript Preloaders need to be small. Preloaders need to load quickly or there is no real point in creating one. So remember a simple nice looking preloader will work better then a fancy complex animation.
The concept of a Flash CS4 Preloader is rather simple. You tell Flash using ActionScript to compare the amount of data loaded with the total data in the movie. Then as this comparison value changes go do something, in the case of this Flash CS4 Tutorial that something is to fill a box.
Let get this Flash CS4 Tutorial under way, by download the source files. As normal in this Flash CS4 Tutorial some of the work has been done for you. You should see that the layer panel in the main time line looks like the example below. You should take note of the layers panel. You will see an object named and labeled bar_mc. That object is the magic behind this Flash CS4 Tutorial. First thing you need to do is to add a stop(); tag to the first key frame in the actions layer. The stop(); tag is so that the movie(swf) will stop at this point until we tell it to do something. In this Flash tutorial we want the time line to stop here until the preloader has finished.
Stop(); root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressAction);
Now you need to add the code from the example. Stop(); should already be there if your following along with this Flash CS4 Tutorial. By coping this code you are adding an event listener to the root time lines loaderInfo property. And then you are telling Flash to listen for the progress of that event. Basically, you are telling flash to track what on the main time line has loaded and whenever something is being loaded call the function progressAction.
Next, in this Flash CS4 Tutorial we will define the function progressAction. On the next line in the actions panel lets create the function progress action. Copy and Paste the following:
function progressAction(yourEvent:ProgressEvent):void {
var yourProgress:Number=yourEvent.target.bytesLoaded/yourEvent.target.bytesTotal; bar_mc.scaleX=yourProgress; myTextField_txt.text = Math.round(yourProgress*100)+"%"; };
If you have completed my other Flash CS4 Tutorials then the first line should be very familiar. If not what you have done is created the function called progressAction given it the parameter of ProgressEvent then voided the data type. What may not be as apparent are the next few lines. First you are creating a variable called yourProgress data typing it as a Number then setting it equal to something. In this Flash Tutorial that something is the amount of bytes loaded. The rest of the line is a property of Flash, I'm just giving you the code to access it.
On the next line we access the magic of the bar_mc. This is really cool so pay attention. All you are going to do is set the width of bar_mc = to yourProgress. That means that when nothing has loaded the width of bar_mc is equal to 0. Ok, so it isn't magic but it sure seems to be magic to those that do not know how to do it. In the last we are going to add the text to myTextField_text. You need to use Math.round() so that you get a whole number and not something like .3435346523862334 multiply it by 100 because bytes loaded comes in as a decimal with 1 being fully loaded. If you want to check it add a trace tag. +"%" simply adds the percent sign to the end of the number.
So, you now have a bar that grows with the amount of data loaded in the main time line, but nothing else happens. You need to make the movie play when the function progressAction is finished. There are several ways to do make Flash CS4 do something when it has finished loading. First, I'm going to show you the simplest way. You can simply add an if statement that checks to see when yourProgress is equal to or greater then 1. If yourProgress is greater or equal to one then play.
myTextField_txt.text = Math.round(yourProgress*100)+"%"; if if (yourProgress >= 1){ play(); }
Or add the following code, after your current function.
root.loaderInfo.addEventListener(Event.COMPLETE, finished); function finished(yourEvent:Event):void { play(); };
After you decide which method you want to use you can press Control-Enter to test your movie.
If this Flash CS4 Tutorial isn't working for you it is most likely because you are testing from you local machine and the file is already loaded. You need to use a few features of the Flash Player to test your preloader. First, you may want to turn on the bandwidth profiler. Press Control-B or View / Bandwidth Profiler.
For your preloader to work you need to adjust the Download setting. Go to View / Download Settings normally I chose DSL but feel free to set your simulation to whatever you want. Last step is to Press Control-Enter or View / Simulate Download. The first time you pressed Control-Enter was in Flash to render or publish the swf. The second time you press Control-Enter is in the actual swf, and this time you start the download sequence. Continue Smiley
Congratulation, you have a preloader. Feel free to modify the code in anyway. Think about changing alpha, rotation and/or just about any property Flash has and by all means send your friends links to my web site. FrenchSquared.com
Links to a few of My Favorite Flash CS4 Web Sites
- Wordpress Themes
1 reviews - 3 months ago
- WordPress &8250; frenchsquared & Free WordPress Themes
1 reviews - 3 months ago
IT Admin, everything computer related
- CSS, How to understand inline and block level elements.
Block level elements are normally displayed as blocks with line breaks before and after. Examples of block level elements include paragraphs, headings, divs and block quotes. Inline elements are... - 3 months ago
- CSS, How To tweak css for only Safari?
If you have spent anytime dealing with CSS you have run into issues with a browser rendering code incorrectly. You may even have gone as far as to make several style sheets and use a browser check... - 3 months ago
- CSS, How to Hide Styles from Older Browsers?
Some older browsers, such as Netscape Navigator 4 and IE 4, have poor support for CSS. It is possible to hide styles from these browsers using specific media types and @import rules. All styles will... - 3 months ago
- CSS, How to use @import styles
@import Styles? Header and external style sheets also can import other style sheets using the @import rule. The @import rule must be placed before all other rules in the header or external style... - 3 months ago
- CSS, How to use External Style Sheets!
The third method of applying styles to document involves linking to external style sheets. External style sheets are the most appropriate method for styling documents. If styles need to be... - 3 months ago
- CSS, How to Use Header Styles
Header styles also can be used to style the <p> element. The CSS rules can be placed in the head of the document using the style element. Like inline styles, header styles, header styles... - 3 months ago
- CSS, How to Apply Inline Styles.
CSS, Inline styles can be applied directly to elements in the HTML code using the style attribute. However, inline styles should be avoided wherever possible because the styles are added to the HTML... - 3 months ago
- Twitter Weekly Updates for 2009-08-09
New blog post: CSS, What is a <div> http://bit.ly/Sbfu # Flash, ActionScript tutorials on loops http://bit.ly/QMq8t # Great PHP Tutorial on using include and require. Include is a great way... - 3 months ago
CSS How To
- CSS, How to work with content areas.
The content are of a box can be given width, height, and color. Width and height can be specified in points (equal to 1/72 of an inch), picas (equal to 12 points), pixels, ems, exes, millimeters, centimeters, inches, or percents. - 6 weeks ago
- Twitter Weekly Updates for 2009-09-20
My Farmville is broken, cant access, gifts, market, or ribbons # Farmville and zynga are a rip off. Watch out. There are still some glitches in the game and zynga told me to bad Im unimportant. # wouldnt it make more since for a developer to fix broken issues rather then add new features. Well not farmville, [...] - 2 months ago
- Twitter Weekly Updates for 2009-09-06
I need 5 more neighbors on FarmVille help me out. http://bit.ly/tLsni # looking for flash tutorials and how to guides check out – http://frenchsquared.com/ # Powered by Twitter Tools - 2 months ago
- Twitter Weekly Updates for 2009-08-30
New version of Wordpress theme adStyle is live at: http://wordpress.org/extend/themes/adstyle # Just finished installing OS X 10.6 on my new Solid State drive. Very impressed, seems noticeably faster. # I need more neighbors on Farmville for Facebook. Hit me up as a friend. http://bit.ly/tLsni # playin farmville on my macbook 10.6 and new solid sate sata II [...] - 2 months ago
- CSS, How to properly use Border Styles.
The border properties specify the width, color and style of the border of an element. Shorthand border properties include border-top, border-bottom, border-right, border-left and border. - 3 months ago
- CSS, How to Padding Padding and more Padding
Padding can be applied to the outside edges of the content area of any block level or inline element. Padding creates the space between the edge of the element and its content. - 3 months ago
- Twitter Weekly Updates for 2009-08-23
Wordpress liked my theme. They have asked that a make a few revisions and resubmit. Sounds like my theme may get accepted! # how long does it normally take for wordpress to get back to you after submitting a theme? # Just finished update my first wordpress theme http://wordpress.org/extend/themes/adstyle # New wordpress theme made for adsense check it out [...] - 3 months ago
- CSS, How to deal with background color and images.
The background-color property sets the background color of an element. The backgound-image property applies a background image to an element, which will appear on top of any background-color. - 3 months ago
PrintShare it! — Rate it: up down flag this hub
Comments
It would be great if you can provide some source files to download, for practice :)
hey guys check this out !! http://www.flashcs4tutorials.com/Flash_CS4_Tutoria
same tutorial. i think these people copy it from them. there is download files with above link. but it is not for free !! :-(
It isnt copied when it is the same writer. These hub pages are just meant to help user find the main tutorial site. All Tutorials are free, however the source files are not. The source files range from $1.98 to $3.98
Thanks for these great resources for learing. I also find that playerdiy.com is a good site for making customized web FLV player. It aslo offers free preloader templates for FLV player - http://www.playerdiy.com/configuration/skins/custo









ilike2 says:
17 months ago
Interesting tutorial