Quantumwave Interactive Inc.
  Interactive media development . Programming . Design . Consulting

DAVE (Dynamic ActionScript Virtual Engine) - formerly known as Object.QWI

DAVE is a framework for programming in ActionScript. This framework is based on an object-oriented approach which simplifies the process of revisions, enables easy maintenance and code reuse.

QwiEventClip - The basis of DAVE: using inheritance to construct movieclip event objects.

A common problem with the Flash movie structure is scattered code. Since ActionScript code can live in frames, attached to movieclips and buttons - a typical movie has code hidden within multiple levels of movieclips, buttons and frames. This creates an obstacle when locating and debugging code.

Another related problem with the typical Flash movie structure is when graphics need to be revised. Suppose a programmer sends a movie to an artist (who has little knowledge of how the code works) for artwork revision; by changing the artwork (movieclips or whatever), the artist could accidentally delete or alter the code attached.

One way to solve these problems is to centralize code, keeping code external as individual library files. This makes code organization, global find & replace, and reuse much easier. What DAVE tries to do is to simplify this process, keeping majority of the code external, *unattached to movieclips*. It also introduces the idea of setting movieclip behaviors by extending class objects.

How to use it?

For example, to make a movieclip behave as a draggable object, just inherit from the Draggable class. For a movieclip named mc, this is the code to do it:


That's all there is to it: the movieclip mc is now draggable. To define what this movieclip does when dragged or released, define your own event handlers such as:

mc.mouseDown = function() {...};
mc.mouseUp = function() {...};

Another example: creating up/down scroll buttons for a scrollable text field. With two movieclip buttons, one pointing up (movieclip name: scrollUp) and the other pointing down (movieclip name: scrollDown), and a scrollable text field "msg" at the _root. This is the code to make the movieclip buttons work:

scrollUp.mcExtends(ScrollUpButton, "_root.msg");
scrollDown.mcExtends(ScrollDownButton, "_root.msg");

From the users' perspective, the internal details of how DAVE works are not important. All they need to know is what classes there are, what they do, and how to extend them...etc. For example, to make a movieclip to accept double-clicks, simply do this:


...and define two event handlers to handle the different types of click:

mc.singleClicked = function() {...};
mc.doubleClicked = function() {...};

For other simpler movieclips, just inherit from QwiEventClip and define event handlers as needed. All these code can be located outside of the movie, as this package demonstrates. The only user code inside the FLA movie is the #include directive.

Source file: DAVE is unavailable at this moment. Download the latest version of qwiEventClip for now.
See also: Object inheritance, MovieClip inheritance, Static methods and variables, Invoking superclass method.

home | about | news | flash | director | shockwave | download | dave | résumé | contact

Copyright © 1995-2009 Quantumwave Interactive Inc.