ActionScript Reference

com.bjc.ccs1

class BJCPollMeter

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



class BJCPollMeter
extends UIComponent

The BJC Poll Meter is a control component that allows users to monitor specific values in poll view. The BJC Poll 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. The BJC Poll Meter has two modes: 'Automatic' and 'Manual'. The Automatic mode adds values to the meter continuously. The Manual mode adds values with the value adding method 'addValue'. For wider value inspection area increase the value area length in the parameters panel.

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

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
Mode: String (write-only)
This property may be used to set the meter mode.

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

public
SampleRate: Number (write-only)
This property may be used to set the sample rate (in milliseconds) 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.

Constructor


BJCPollMeter ( )
Constructor

Method Summary

public
addValue ( value: Number ): Void
This method may be used to add a value to the poll meter.

public
clear ( ): Void
This method may be used to clear the poll sheet.

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

public
setBgColor ( col: Number ): Void
This method may be used to set the background color of the poll 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
setMode ( mod: String ): Void
This method may be used to set mode of the poll meter.

public
setPollColor ( pCol: Number, aCol: Number ): Void
This method may be used to set the poll color and alert color of the poll meter.

public
setSampleRate ( value: Number ): Void
This method may be used to set the amount of milliseconds between adding values.

public
setScale ( min: Number, max: Number, aMin: Number, aMax: 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.



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.

FeederLength

public FeederLength: Number (write-only)
This property may be used to set the width of the value area in pixels.

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.

Mode

public Mode: String (write-only)
This property may be used to set the meter mode.

PollColor

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

SampleRate

public SampleRate: Number (write-only)
This property may be used to set the sample rate (in milliseconds) 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.


Constructor Documentation

BJCPollMeter

function BJCPollMeter()
Constructor


Method Documentation

addValue

public function addValue(value: Number): Void
This method may be used to add a value to the poll meter.

This method may be used to add a value to the poll meter. If the poll meter mode is set to 'Automatic', the poll meter will add polls indicating the given value continuously at the spesified speed rate. Otherwise the poll meter will add only one poll indicating the given value.

Usage:
myBJCPollMeter.addValue( 34 );

Parameters:
value
The poll meter will add a poll indicating the given value.
Returns:
Nothing.

clear

public function clear(): Void
This method may be used to clear the poll sheet.

Usage:
myBJCPollMeter.clear();

Returns:
Nothing.

getValue

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

Usage:
myVar = myBJCPollMeter.getValue();

Returns:
The current value of the poll meter.

setBgColor

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

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

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

setMode

public function setMode(mod: String): Void
This method may be used to set mode of the poll meter.

This method may be used to set mode of the poll meter. The automatic mode will add polls continuously at the current value. The poll adding speed is spesified in the component parameters. The manual mode adds only one poll at a time with the addValue method.

Usage:
myBJCPollMeter.setMode( "Manual" );

Parameters:
mod
The mode of the poll meter to be set. The mode can be either 'Automatic' or 'Manual'.
Returns:
Nothing.

setPollColor

public function setPollColor(pCol: Number,
aCol: Number): Void
This method may be used to set the poll color and alert color of the poll meter.

Usage:
myBJCPollMeter.setBgColor( 0xff0000, 0x00ff00 );

Parameters:
pCol
A color value that indicates the color of the upcoming polls in the component.
aCol
A color value that indicates the color of the upcoming polls with values that are within the alert range.
Returns:
Nothing.

setSampleRate

public function setSampleRate(value: Number): Void
This method may be used to set the amount of milliseconds between adding values.

Usage:
myBJCPollMeter.setSampleRate( 100 );

Parameters:
value
The amount of milliseconds between adding values in the 'Automatic' mode.
Returns:
Nothing.

setScale

public function setScale(min: Number,
max: Number,
aMin: Number,
aMax: 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 poll 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:
myBJCPollMeter.setScale( 0, 100, 70, 100 );

Parameters:
min
The minimum value of the meter range.
max
The maximum value of the meter range.
aMin
The minimum value of the meter alert range.
aMax
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:
myBJCPollMeter.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:
myBJCPollMeter.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.