ActionScript Reference

com.bjc.ccs1

class BJCDigitalMeter

mx.core.UIComponent
  |
  +--com.bjc.ccs1.BJCDigitalMeter



class BJCDigitalMeter
extends UIComponent

The BJC Digital Meter is a control component that allows users to monitor specific values in digital view. The BJC Digital Meter executes it's user defined callback function if given values are within the alert range. The callback function will receive the alert causing value.

Usage:
myBJCDigitalMeter.setCallback( "myCallback" ); // Set the function to call on alert
 
function myCallback( value )
{
	trace( "ALERT: " + value ); // This code will run on alert
}
 
myBJCDigitalMeter.setValue( 100 ); // Set meter value


Author:
Flashloaded - www.flashloaded.com

Version:
1.5.0


Property Summary

public
AlertColor: Number (write-only)
This property may be used to set the alert color.

public
BgColor: Number (write-only)
This property may be used to set the background color.

public
CallBackFunction: String (write-only)
This property may be used to set the function to be called when the meter is given a value within the alert range.

public
DigitsVisible: String (write-only)
This property may be used to hide or show the digital numbers.

public
Font: String (write-only)
This property may be used to set the text font.

public
FontColor: Number (write-only)
This property may be used to set the font color.

public
MaxAlert: Number (write-only)
This property may be used to set the maximum alert range value of the meter.

public
MaxValue: Number (write-only)
This property may be used to set the maximum value of the meter.

public
MinAlert: Number (write-only)
This property may be used to set the minimum alert range value of the meter.

public
MinValue: Number (write-only)
This property may be used to set the minimum value of the meter.

public
Title: String (write-only)
This property may be used to set the title.

public
TitleVisible: String (write-only)
This property may be used to hide or show the title field.

Constructor


BJCDigitalMeter ( )
Constructor

Method Summary

public
getValue ( ): Number
This method may be used to get the current value of the digital meter.

public
setAlertColor ( col: Number ): Void
This method may be used to set the alert range color of the digital meter.

public
setBgColor ( col: Number ): Void
This method may be used to set the background color of the digital meter.

public
setCallback ( cb: String ): Void
This method may be used to set the function to be called when the meter is given a value within the alert range.

public
setDigits ( view: Boolean ): Void
This method may be used to set the visibility of the digital numbers.

public
setScale ( min: Number, max: Number, alertMin: Number, alertMax: Number ): Void
This method may be used to set the value and alert ranges.

public
setTitle ( view: Boolean, font: String, color: Number, text: String ): Void
This method may be used to set the visibility of the title field and changes the title text.

public
setValue ( value: Number ): Void
This method may be used to set the value of the digital meter.



Property Documentation

AlertColor

public AlertColor: Number (write-only)
This property may be used to set the alert color.

BgColor

public BgColor: Number (write-only)
This property may be used to set the background color.

CallBackFunction

public CallBackFunction: String (write-only)
This property may be used to set the function to be called when the meter is given a value within the alert range.

DigitsVisible

public DigitsVisible: String (write-only)
This property may be used to hide or show the digital numbers.

Font

public Font: String (write-only)
This property may be used to set the text font.

FontColor

public FontColor: Number (write-only)
This property may be used to set the font color.

MaxAlert

public MaxAlert: Number (write-only)
This property may be used to set the maximum alert range value of the meter.

MaxValue

public MaxValue: Number (write-only)
This property may be used to set the maximum value of the meter.

MinAlert

public MinAlert: Number (write-only)
This property may be used to set the minimum alert range value of the meter.

MinValue

public MinValue: Number (write-only)
This property may be used to set the minimum value of the meter.

Title

public Title: String (write-only)
This property may be used to set the title.

TitleVisible

public TitleVisible: String (write-only)
This property may be used to hide or show the title field.


Constructor Documentation

BJCDigitalMeter

function BJCDigitalMeter()
Constructor


Method Documentation

getValue

public function getValue(): Number
This method may be used to get the current value of the digital meter.

Usage:
myVar = myBJCDigitalMeter.getValue();

Returns:
The current value of the digital meter.

setAlertColor

public function setAlertColor(col: Number): Void
This method may be used to set the alert range color of the digital meter.

Usage:
myBJCDigitalMeter.setAlertColor( 0xff0000 );

Parameters:
col
A color value that indicates the alert range color of the component.
Returns:
Nothing.

setBgColor

public function setBgColor(col: Number): Void
This method may be used to set the background color of the digital meter.

Usage:
myBJCDigitalMeter.setBgColor( 0xff0000 );

Parameters:
col
A color value that indicates the background color of the component.
Returns:
Nothing.

setCallback

public function setCallback(cb: String): Void
This method may be used to set the function to be called when the meter is given a value within the alert range.

This method may be used to set the function to be called when the meter is given a value within the alert range. The called function must be in the same timeline as the component or the path to the function must be specified as well.

Usage:
myBJCDigitalMeter.setCallback( "_root.cbFunc" );

Parameters:
cb
The function to be called when the meter is given a value within the alert range.
Returns:
Nothing.

setDigits

public function setDigits(view: Boolean): Void
This method may be used to set the visibility of the digital numbers.

Usage:
myBJCDigitalMeter.setDigits( true );

Parameters:
view
A boolean value that indicates the visibility of the digital numbers.
Returns:
Nothing.

setScale

public function setScale(min: Number,
max: Number,
alertMin: Number,
alertMax: Number): Void
This method may be used to set the value and alert ranges.

This method may be used to set the minimum value, maximum value, minimum alert value and maximum alert value of the digital meter. The alert range must be within the value range of the meter. The alert range has a defined callback function which is invoked by a value that is within the alert range.

Usage:
myBJCDigitalMeter.setScale( 0, 100, 70, 100 );

Parameters:
min
The minimum value of the meter range.
max
The maximum value of the meter range.
alertMin
The minimum value of the meter alert range.
alertMax
The maximum value of the meter alert range.
Returns:
Nothing.

setTitle

public function setTitle(view: Boolean,
font: String,
color: Number,
text: String): Void
This method may be used to set the visibility of the title field and changes the title text.

Usage:
myBJCDigitalMeter.setTitle( true, "Arial", 0xff0000, "RPM" );

Parameters:
view
A boolean value that indicates the visibility of the title field.
font
The font name that will be used in the component. May be set to null to disable this change.
color
A color value that indicates the font color of the component. May be set to null to disable this change.
text
A string value that indicates the title. May be set to null to disable this change.
Returns:
Nothing.

setValue

public function setValue(value: Number): Void
This method may be used to set the value of the digital meter.

Usage:
myBJCDigitalMeter.setValue( 100 );

Parameters:
value
The digital meter will be set to the given value.
Returns:
Nothing.