Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 

 
AS2 OOP: Class Structure
         by senocular  

Introduction
To learn classes all over again. Just when you thought you had it straight with ActionScript 1.0, Macromedia goes and does a thing like this. It's not as bad as it seems though. This new method of defining classes with ActionScript 2.0 can actually be easier than with ActionScript 1.0. That is, once you get past the fact that each class needs to exist in its own file (that can be hard to get used to). If you've already been doing this using #include, though, it may not be a big deal.

Whenever a class is defined with ActionScript 2.0, it gets its own .as (ActionScript) file. These .as files for classes can only have one class per file and need to have the same name as the class being defined within. For example, if you were defining a Plane class, its definition, including all its variables and methods, would be included in a Plane.as file. This may seem a tedious process at first, but its another step in maintaining organization and improving your coding practices. The advantages are less apparent in smaller projects. But with the bigger ones, you'll definitely see a difference.

Within these files goes the code that basically defines ActionScript 2.0. Elsewhere, such as within your main movie, you're still pretty much still dealing with ActionScript 1.0, or at least its familiar syntax. ActionScript 2.0, however, is the language for writing classes. So let's see how that works.

 

 

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components Free Website | Make a Website
Learn how to advertise on kirupa.com