Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Master the Time-saving Power of Flash Components, Part 1

In Flash, components—drag-and-drop modules of assets and code—are frequently used to promote code reuse and conserve file size, but they're not always cross-version compatible. Find out how to build components that work across several versions of Flash.


advertisement
ow often have you found yourself repeating the same tasks in Flash over and over? Perhaps you've recreated a logo or animation, or rewritten some simple script again and again. Wouldn't it be great if you could drag and drop a widget into your file and just have it work? With Flash components you can often do just that.

Components are self-contained units, usually comprised of graphics and code, that you can simply drop into your file to serve a specific purpose. Components can include preloaded animations, buttons, or even code-only tasks such as a timer.

You may have tried using existing Flash components or even added third-party components to your applications, but wouldn't it be ideal if you could create your own component that did exactly what you wanted it to do? This article will help you accomplish that goal.



Defining Components
For the uninitiated, MovieClips are one of the three symbol types that promote efficient reusability of Flash assets. A graphical element that begins life as a circle drawn on the stage, for example, is called a shape and might be considered a 'one-time use' asset. That is, each time that circle is used, it is essentially recreated, and contributes to file size. Converting that shape into a symbol, in this case a MovieClip, places a copy of that graphical element into the library of a Flash file. Thereafter, repeated uses of that element within the same file are, essentially, references rather than new copies. This promotes reusability, improves performance and reduces file download times.

What You Need
Components are basically self-contained, reusable combinations of MovieClips extended with the power of ActionScript. This article does not require fluency in either MovieClips or ActionScript but you may find a smoother road into the world of components if you have at least a fundamental understanding of both.

ActionScript, as the native scripting language of Flash, allows us to exert programmatic control over MovieClips, and gives developers the tools with which to create richer interactive experiences. Add the ability to reuse ActionScript, as well as graphical assets—all with drag-and-drop simplicity—and you have a Flash component.

To download the souce code for this article:

Author's Note: The material from which this article was derived will be presented in a session called "Authoring Components" at the FlashForward 2005 conference in San Francisco, April 6-8.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap