All about preloader Part IV - Preloader in AS3
Based on Part III’s codes, converting AS2 preloaders into AS3 is pretty simple.
Shang :: May.20.2008 :: actionscript 3, beginner :: No Comments »
Based on Part III’s codes, converting AS2 preloaders into AS3 is pretty simple.
Shang :: May.20.2008 :: actionscript 3, beginner :: No Comments »
Shang :: May.07.2008 :: beginner, best practice, good-to-know :: No Comments »
The most important information for a preloader is the number of bytes loaded and the total number of bytes of the file (file size). In ActionScript 2, getBytesLoaded and getBytesTotal functions serve the purpose. The most basic implementation is like this:
stop(); function preload() { var l:Number = getBytesLoaded();// loaded bytes of the swf file var t:Number = getBytesTotal();// total bytes of the swf file var p:Number = l/t;// percentage loaded of the swf file, value range from 0-1 updatePreloader(l,t,p); if (p == 1) { onEnterFrame = null;// remove onEnterFrame loop gotoAndStop("main");// go to the main frame } } function updatePreloader(l:Number,t:Number,p:Number){ //most of the time l and t are not used, but just in case you need it there's no harm to keep them trace("bytesLoaded: "+l+" bytesTotal: "+t+" percentage: "+p); } onEnterFrame = preload;
Based on Part II’s 2 keyframes structure, the codes above should be placed in the “preloader” key frame and core codes should be placed in “main” key frame.
Visuals for indicating the loading progress can be easily extended from the basic codes shown above. All we need to do is to play around with updatePreloader function. Here’s a list of simple visuals:
Shang :: May.06.2008 :: beginner :: No Comments »
Before building a preloader, let’s take a look at how SWF files loads.
SWF files are displayed in a streaming manner. Frames in the main timeline are loaded from 1 to the end (from left to right in Flash IDE). The user will be able to see a frame once it is loaded, without loading the whole SWF file. Because of the streaming nature, a SWF file with only one frame in the main timeline will only show up until everything is loaded. A preloader is not needed in such situation. In order to make a preloader visible during the preloading phase, preloader should be placed in the first frame and the contents should be placed in some frames behind it.
Continue Reading »
Shang :: Apr.21.2008 :: beginner, best practice :: 1 Comment »
…(a preloader) consists of a quickly-loaded smaller movie, image or text with a message that tells the viewer to wait while the rest of the larger object is loaded. - Wikipedia
According to the definition, a preloader should be a small message that indicates a large object is loading. A good preloader follows the definition closely, small, quick load and informative. A simple looping animation works, pure text works and a line in the stage is pretty neat too.
A common mistake is called “preloading the preloader”, which means that the preloader makes up the majority of the file size and it is too big to be loaded quickly. It may sound silly but you do spot it from time to time. Unfortunately, there isn’t an exact figure to measure whether the preloader is too big or not. It’s up to the designer or developer’s judgment.
Fortunately, preloader is getting less and less important nowadays. One reason is because bandwidth is getting bigger so the preloading time is much shorter. But more importantly, people realized more time should be spent in developing the content rather than a stunning preloader.
Shang :: Apr.05.2008 :: beginner, best practice :: 2 Comments »
There are some security restrictions. The full article can be found in Adobe’s website. Two restrictions are very important:
This restriction keeps most website/application away from fullscreen mode. Almost all websites and applications need keyboard interaction. Bringing the user out of fullscreen mode to fill up a form is not user-friendly.
It was stated in Square Factor’s blog that the reason for disabling input is to avoid phishing activities. “…attacker could mimic the look of the operating system / browser to force user to enter sensitive data, such as passwords or serial numbers.”
Shang :: Mar.23.2008 :: actionscript 3, beginner, good-to-know :: 1 Comment »
Regardless of whether you are a seasoned developer or a designer or a complete newbie, (re)familiarizing yourself with the software and basic terminology is a good place to start. Here is a list of tips all Flash users should know.
Shang :: Mar.09.2008 :: beginner, good-to-know :: No Comments »