ActionScript Reference

com.bjc.ccs1

class BJCAnalogMeter

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



class BJCAnalogMeter
extends UIComponent

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

Usage:
myBJCAnalogMeter.setCallback( "myCallback" ); // Set the function to call on alert
 
function myCallback( value )
{
	trace( "ALERT: " + value ); // This code will run on alert
}
 
myBJCAnalogMeter.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
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
Separators: Number (write-only)
This property may be used to set amount of separators.

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.

public
ValueVisible: String (write-only)
This property may be used to enable or disable the value field.

Constructor


BJCAnalogMeter ( )
Constructor

Method Summary

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

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

public
setBgColor ( col: Number ): Void
This method may be used to set the background color of the analog 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
setScale ( min: Number, max: Number, alertMin: Number, alertMax: Number ): Void
This method may be used to set the value and alert ranges.

public
setSeparators ( amount: Number ): Void
This method may be used to set amount of separators in the meter.

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 analog 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.

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.

Separators

public Separators: Number (write-only)
This property may be used to set amount of separators.

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.

ValueVisible

public ValueVisible: String (write-only)
This property may be used to enable or disable the value field.


Constructor Documentation

BJCAnalogMeter

function BJCAnalogMeter()
Constructor


Method Documentation

getValue

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

Usage:
myVar = myBJCAnalogMeter.getValue();

Returns:
The current value of the analog meter.

setAlertColor

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

Usage:
myBJCAnalogMeter.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 analog meter.

Usage:
myBJCAnalogMeter.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:
myBJCAnalogMeter.setCallback( "_root.cbFunc" );

Parameters:
cb
The function to be called when the meter is given a value within the alert range.
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 analog 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:
myBJCAnalogMeter.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.

setSeparators

public function setSeparators(amount: Number): Void
This method may be used to set amount of separators in the meter.

Usage:
myBJCAnalogMeter.setSeparators( 5 );

Parameters:
amount
The amount of the separators to be set.
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:
myBJCAnalogMeter.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 analog meter.

Usage:
myBJCAnalogMeter.setValue( 100 );

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