|
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:
mc.mcExtends(Draggable);
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:
mc.mcExtends(DoubleClickable);
...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.
|