MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 920

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Creating the Dial class file
The following is the ActionScript class for the Dial component. Please read the comments in the
code for a description of each section.
To create this file, you can create a new ActionScript file in the Flash IDE, or use any other text
editor. Save the file as Dial.as in the same folder as the Dial.fla file.
// Import the package so you can reference
// the class directly.
import mx.core.UIComponent;
// Event metadata tag
[Event("change")]
class Dial extends UIComponent
{
// Components must declare these to be proper
// components in the components framework.
static var symbolName:String = "Dial";
static var symbolOwner:Object = Dial;
var className:String = "Dial";
// The needle and dial movie clips that are
// the component's graphical representation
private var needle:MovieClip;
private var dial:MovieClip;
private var boundingBox_mc:MovieClip;
// The "value" property is a getter/setter,
// so that you can update the needle's position
// when the value is set. This is a private
// variable that stores the value.
private var __value:Number = 0;
// This flag is set when the user drags the
// needle with the mouse, and cleared afterwards.
private var dragging:Boolean = false;
// Constructor; does nothing,
// but is required for all classes.
function Dial() {
}
// Initialization code
function init():Void {
super.init();
useHandCursor = false;
boundingBox_mc._visible = false;
boundingBox_mc._width = 0;
boundingBox_mc._height = 0;
}
private function createChildren():Void
{
dial = createObject("DialFinal", "dial", 10);
920
Chapter 7: Creating Components

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

This manual is also suitable for:

Flash mx

Table of Contents