How Flash Works (Entertainment)

Published Date
01 - Dec - 2007
| Last Updated
01 - Dec - 2007
 
How Flash Works (Entertainment)

You may be a YouTube regular, but do you know how those movies come to you?



Flash is one of the most important mediums for delivering content on the Internet. In fact, Web 2.0 would not have been what it is without Flash. It is used in applications like online photo editors, interactive tutorials, online forms, shopping carts, games, database front-ends, and many more. Flickr, Picasa Web Albums, Picnik, and YouTube are some of the Web 2.0 sites that are either built entirely using Flash or incorporate significant elements of it. Flash is cross-platform and ubiquitous—almost all browsers come with the free Flash Player.
 
The Guts Of Flash

Before understanding how Flash works its magic, we need to understand how animation on the Web works. Take a simple animated image, say a wheel rolling on a surface, or a ball bouncing about. These are animated GIF images: a series of image files placed in sequence. Though animated GIFs provided a welcome change from static text and images, this method was not perfect. Animated GIFs take up a lot of space because image files are duplicated a number of times. The quality of the resulting animation is jerky, no sound can be incorporated, and complicated animations are impossible. Also, due to the rapid increase in file sizes, practical-length movies cannot be created.

Sound effects are one of the most important factors that make today’s games the immersive experiences that they are. FPS games place a lot of emphasis on sound and it takes a fair bit of work before all the effects are aurally displayed. In most of the cases the sound that one hears in a game depends upon the position of the camera, and obstruction and occlusion play an important role here. When a conversation is taking place in another room the voices appear muted and muffled. This is occlusion, while obstruction is when the obstacle between the sound source and the player is something like a pillar. This difference is determined based on the calculation of presence of obstacles in the world, and can rapidly change. Sound effects can also be tweaked depending on the environment—for example in a corridor, underwater or in a cinema hall.

Flash gets around these limitations by employing some novel techniques. A Flash presentation, also known as a “movie,” is divided into frames. Ordinary animation needs to download each of the frames for the movie to be played. On slow connections, this might mean you making a cup of coffee while waiting for the movie to load. This, naturally, detracts from the interactivity. In a Flash movie, an image that needs to be animated is downloaded once and stored in the client memory. In subsequent steps, instructions are downloaded by the Flash player; these tell it what to do with each of the elements in the original image file. This is a job for the processor, which is faster than your modem. If the Flash movie is a game or a tutorial, it will use interactive elements like buttons that activate upon mouse clicks. Here, too, the images of the buttons are loaded in the initial frame, with the instructions on mouse events, which are executed by the processor.

Even if the movie is long, the Flash player starts playing the movie before all the instructions have been processed. This is because Flash uses streaming techniques: part of the file is played in the foreground while another part is being loaded in the background. Sometimes, though, for longer movies, it might play in a jerky fashion even if streaming is implemented. To help this cause, most Flash front-ends have pause, play, rewind, and forward buttons.

Another advantage Flash animation has over formats like animated GIF is that Flash movies have the same quality at all resolutions, while animated GIF exhibits grainy images when viewed at higher resolutions. Animated GIF uses pixel-based artwork where individual pixels contain colour information, which stand apart at high resolutions, resulting in quality degradation. Flash uses vector graphics which uses mathematical equations and geometric objects like points, lines, curves, and polygons to represent images. They scale infinitely without degradation. The use of vector graphics also means that Flash movies are smaller in size and load faster.

Sound in Flash is one of the most important reasons that it is all over the Internet. In most cases, transmitting sound is a tough job, mainly because of variable Internet speeds and the difference in file sizes of sound and image files. In Flash there are two types of sounds—event sounds and streaming sounds. Event sounds, like mouse clicks, are fairly easy to implement and work the same way images work: the sounds are loaded and then instructions on when to play the sound depending on animation events. The second method, which involves streaming sound, is a comparatively harder nut to crack. When the videos are animated, the sound stream is given preference over the animation (because images would show up faster than sound). This ensures that what you see and what you hear does not get out of sync.

Shockwave And Flash

We often come to sites where a pop-up message says the Shockwave plugin is needed. Shockwave is similar to Flash: there are only a few differences, though Shockwave can be used to make more versatile animations than Flash. Shockwave was originally intended for media like CDs, while Flash was built keeping the Internet architecture in mind. Flash is open source and cross-platform, while Shockwave uses a proprietary file format.

Plus

Apart from being used in streaming content, Flash is currently the number one medium of choice when you want to deliver Rich Internet Applications like interactive advertisements. Even though other technologies like Java applets and Ajax are close competitors, Flash will continue to be in use for years, primarily because of its pervasiveness—and Adobe’s strong support.

Team DigitTeam Digit

All of us are better than one of us.