Some things may not work properly without JavaScript. Please turn on JavaScript.

Documentation

Everything you need to know about the Cyntaxic framework is here at
your disposal. If you are not into the whole brevity thing, the complete reference is just a subdomain away.

Cyntaxic Class

Description

The Cyntaxic framework is a MVC based design pattern created to address everyday coding, while keeping it simple. Top level objects like root & stage can be referenced statically from the Cyntaxic base class. It also comes bundled with a bunch of commonly used utility functions and a built in debugger.

Properties

VERSION

public static function get VERSION():String

Returns the version number of the framework as a string.

STAGE

public static function get STAGE():Stage

Returns the stage instance of the application. Attempts at setting will throw an CynError.

ROOT

public static function get ROOT():DisplayObject

Returns the root of the application. Attempts at setting will throw an CynError.

FLASH_VARS_VO

public static function get FLASH_VARS_VO():FlashVarsVO

Returns FlashVars as a value object. Attempts at setting will throw an CynError.

DEBUGGER

public static function get DEBUGGER():Debugger

Returns the debugger instance. The debugger has one function, log which takes 2 arguments. The messenger and the message. The controller and views have shortcut functions for this that assume the first argument as itself. Use this when the intention is to override the messenger parameter. Attempts at setting will throw an CynError.

MODEL

public static function get MODEL():CynModel

Returns the extended CynModel instance. By convention this class should be setup as a singleton. This is a pseudo constant as it only can be set once by the framework. Attempts at setting will throw a CynError.

CONTROLLER

public static function get CONTROLLER():CynController

Returns the extended CynController instance. By convention this class should be setup as a singleton. This is a pseudo constant as it only can be set once by the framework. Attempts at setting will throw a CynError.

contextMenu

public static function get contextMenu():ContextMenu

The root contextual menu.

cmLove

public static function get cmLove():Boolean

Sets whether or not the root contextual menu gives credit to the Cyntaxic framework.

advancedDescribe

public static function get advancedDescribe():Boolean

Makes describe function wrap advanced describe properties in a parent object. The parent object adds the fully qualified class, base class and length if the object described is an array. Default is false.

fullScaleFlash

public static function get fullScaleFlash():Boolean

Determines whether or not the application is set for liquid layout. If this is not set to true CynView resize functions will not fire.

debug

public static function get debug():Boolean

Sets whether or not debugging is enabled.

Methods

init

public static function init(model:CynModel, controller:CynController, doc:DisplayObject = null, props:Object = null):Cyntaxic

Initializes the Cyntaxic framework.

Parameters
model The extended CynModel class.
controller The extended CynController class.
doc The document class of the application. The props object is ignored if doc is null.
props A object containing configuration properties for the framework.
Returns
The Cyntaxic singleton instance.

initDocument

public static function initDocument(doc:DisplayObject, props:Object = null):void

Initializes the document class for the Cyntaxic framework if not available at the time Cyntaxic.init is called.

Parameters
doc The document class.
props A object containing configuration properties for the framework.

go

public static function go(url:String, target:String):void

Goes to a webpage.

Parameters
url The URL to go to.
target The window to open it in.

addCynViewProxy

public static function addCynViewProxy(view:DisplayObject):void

Adds a view to the framework that cannot extend CynComponent or CynComposite. This allows the view to be notified by the contoller.

Parameters
view The proxy view to be added.

removeCynViewProxy

public static function removeCynViewProxy(view:DisplayObject):void

Removes a proxy view from notifications from the controller.

Parameters
view The proxy view to be removed.

CynModel Class

Description

CynModel is an abstract class to be extended by the application being created with the Cyntaxic framework. The model is where all data for the application is stored.

Properties

version

public function get version():VersionVO

Returns the version number and description in a value object.

Methods

describe

public function describe(compact:Boolean = true):String

Returns a valid JSON string describing the object. Objects that can't be used in JSON like the Function object are returned as a string literal.

Parameters
compact If false the string is not compacted.
Returns
A valid JSON string.

get

public function get(handle:Object, url:String, data:Object = null, contentType:String = null, headers:Array = null):void

Sends a HTTP GET call. When the call is complete the controller execute function is called to handle the returned data.

Parameters
handle The callback function handle.
url The URL to be called.
data The data to send to the server.
contentType The content type of the data.
headers The headers to send to the server.

post

public function post(handle:Object, url:String, data:Object = null, contentType:String = null, headers:Array = null):void

Sends a HTTP POST call. When the call is complete the controller execute function is called to handle the returned data.

Parameters
handle The callback function handle.
url The URL to be called.
data The data to send to the server.
contentType The content type of the data.
headers The headers to send to the server.

CynView Class

Description

CynView is the abstract base class for CynComposite and CynComponent. It should be an extended by either a CynComposite or a CynComponent class. If there is an attempt to extend CynView with any other class a CynError is thrown.

Properties

cynModel

protected var cynModel:CynModel

A reference to the CynModel.

cynController

protected var cynController:CynController

A reference to the CynController.

suppressDebug

protected var suppressDebug:Boolean

Flag to set whether debugging is suppressed for this CynView.

describeProperties

protected var describeProperties:Array

List of properties to describe on the view when using describe.

Methods

init

public function init(vo:CyntaxicVO):CynView

Optionally initialize a view. This is useful when extending a graphical objects from a Flash library where the constructor is not available.

Parameters
vo The value object to pass parameters.
Returns
The CynView for chainability.

debug

protected function debug(message:Object):void

Traces out a debugging message.

Parameters
message The message to be traced out.

addListener

public function addListener(type:String, listener:Function, props:Object = null):void

Shorthand method for addEventListener. The first arguments are the same, but the last few are passed in with an object. Named the same as addEventListener.

Parameters
type The type of the event listener.
listener The listener function.
props An object containing any or all of the properties useCapture, priority, and useWeakReference.

addWeakListener

public function addWeakListener(type:String, listener:Function):void

Shorthand method for addEventListener using weak reference. The parameters useCapture and priority are set to the default for addEventListener. To change these use addListener.

Parameters
type The type of the event listener.
listener The listener function.

removeListener

public function removeListener(type:String):void

Shorthand method for removeEventListener. This function differs as the function name does not need to be passed in. It looks for the first event that matches the type and removes it. If there is more than one by the same name, it only removes the first one.

Parameters
type The type of the event listener.

removeAllChildren

public function removeAllChildren():Array

Removes all children of the DisplayObject from the display list. On completion an array of the objects removed is returned.

Returns
An array of the objects removed.

removeAllListeners

public function removeAllListeners():void

Removes all the listeners added.

getListeners

public function getListeners():Array

Returns a copy of the listeners on the CynView.

Returns
An array of the listeners on the CynView.

describeListeners

public function describeListeners(compact:Boolean = true):String

Returns a valid JSON string describing the listeners.

Parameters
compact If false the string is not compacted.
Returns
A valid JSON string.

describe

public function describe(compact:Boolean = true):String

Returns a valid JSON string describing some commonly used display properties. To change the properties being described add or remove from describeProperties.

Parameters
compact If false the string is not compacted.
Returns
A valid JSON string.

resize

public function resize(vo:ResizeVO):void

Invoked when Event.RESIZE event is fired. A ResizeVO is passed in containing stage.stageWidth and stage.stageHeight properties.

Parameters
vo A ResizeVO containing stage.stageWidth and stage.stageHeight properties.

CynController Class

Description

CynController is an abstract class to be extended by the application being created with the Cyntaxic framework. The controller is where all the processing logic is handled in the application.

Properties

cynModel

protected var cynModel:CynModel

Reference to the instance of CynModel.

Methods

execute

public function execute(handle:String, vo:CyntaxicVO):void

Executes a controller function based on the string value of the handle parameter.

Parameters
handle The function handle to be executed.
vo The value object being passed.

notify

public function notify(handle:String, vo:CyntaxicVO):void

Notifies CynView classes to update. This function looks for public functions named the same as the handle parameter in each view.

Parameters
handle The function handle to be notified about.
vo The value object being passed.

debug

protected function debug(message:Object):void

Traces out a debugging message.

Parameters
message The message to be traced out.

CynComposite Class

Description

CynComposite is used for views that have other views inside of it. CynComposite has functions like add, addAt, remove and removeAt which work just like addChild and removeChild except for some added functionality for the framework.

Methods

add

public function add(view:CynView, props:Object = null):CynView

Adds a child CynView to the display list. An optional set of properties can be sent to the object at time of addition. These property names match the properties of other display objects.

Parameters
view The view to be added to the display list.
props An object with display object properties.
Returns
The view that was added.

addAt

public function addAt(view:CynView, index:int, props:Object = null):CynView

Adds a child CynView to the display list at the specified index. An optional set of properties can be sent to the object at time of addition. These property names match the properties of other display objects.

Parameters
view The view to be added to the display list.
index The index to add the object at.
props An object with display object properties.
Returns
The view that was added.

remove

public function remove(view:CynView, completely:Boolean = false):CynView

Removes a child of the CynView from the display list. When the completely flag is set the function completely destroys all reference and nulls out the object as well as its children.

Parameters
view The view to be removed from the display list.
completely Flag set to determine if it is removed or destroyed completely.
Returns
The view that has been removed.

removeAt

public function removeAt(index:int, completely:Boolean = false):CynView

Removes a child of the CynView from the display list at the specified index. When the completely flag is set the function completely destroys all reference and nulls out the object as well as its children.

Parameters
index The index at which to remove the view.
completely Flag set to determine if it is removed or destroyed completely.
Returns
The view that has been removed.

removeSelf

public function removeSelf(event:Event = null):CynView

Removes itself using the remove method. If the parent isn't a CynComposite, the view is just removed with removeChild. If the parent doesn't have either function, the function fails silently.

Parameters
event An optional parameter to invoke on an event.
Returns
The removed view.

destroy

public function destroy(view:CynView):void

Destroys a child of the CynView from the display list. All reference is destroyed and the object is nulled out the object as well as its children.

Parameters
view The view to be destroyed.

destroyAt

public function destroyAt(index:int):void

Destroys a child of the CynView from the display list at the specified index. All reference is destroyed and the object is nulled out the object as well as its children.

Parameters
index The index at which to destroy the view.

destroySelf

public function destroySelf(event:Event = null):CynView

Destroys itself using the destroy method. If the parent isn't a CynComposite, the view is just removed with removeChild. If the parent doesn't have either function, the function fails silently.

Parameters
event An optional parameter to invoke on an event.
Returns
The deleted view.

CynComponent Class

Description

CynComponent is a CynView that has no CynView children.


CynViewProxy Class

Description

CynViewProxy is a decorator for setting up views that cannot directly extend CynComponent or the CynComposite classes. Using the add and remove functions allow views to listen and to unlisten for notifications from the controller. Instances of CynViewProxy are not directly accessible as the constructor is private and the static functions do not return a value.

Properties

actualView

public function get actualView():DisplayObject

Returns the view proxy.

Methods

add

public static function add(view:DisplayObject):void

Adds a view to the framework that cannot extend CynComponent or CynComposite. This allows the view to be notified by the contoller.

Parameters
view The proxy view to be added.

remove

public static function remove(view:DisplayObject):void

Removes a proxy view from notifications from the controller.

Parameters
view The proxy view to be removed.

CyntaxicVO Class

Description

CyntaxicVO is the base class for all value objects.

Methods

describe

public function describe(compact:Boolean = true):String

Returns a valid JSON string describing the object. Objects that can't be used in JSON like the Function object are returned as a string literal.

Parameters
compact If false the string is not compacted.
Returns
A valid JSON string.

getProp

public function getProp(prop:String):Object

Gets a property value by its property name.

Parameters
varName The string value of the property name.
Returns
The value of the property.

CynArray Class

Description

The CynArray class contains static functions for manipulating arrays.

Methods

shuffle

public static function shuffle(array:Array):Array

Shuffles the items of the given array.

Parameters
array The array to shuffle.
Returns
The shuffled array.

copyShuffle

public static function copyShuffle(array:Array):Array

Shuffles an array without shuffling the original.

Parameters
array The array to shuffle.
Returns
The shuffled array.

clone

public static function clone(array:Array):Array

Clones an array.

Parameters
array The array to clone.
Returns
A clone of the array.

removeItem

public static function removeItem(array:Array, item:*):Array

Removes all occurances of a the given item out of the array.

Parameters
array The array to remove the item out of.
item The item to remove.
Returns
List that contains the index of all removed occurances.

removeLastOccurance

public static function removeLastOccurance(array:Array, item:*):Number

Removes the last occurance of the given item out of the array.

Parameters
array The array to remove the item out of.
item The item to remove.
Returns
-1 if it could not be found, else the position where it has been deleted.

removeFirstOccurance

public static function removeFirstOccurance(array:Array, item:*):Number

Removes the first occurance of the given item out of the array.

Parameters
array The array to remove the item out of.
item The item to remove.
Returns
-1 if it could not be found, else the position where it has been deleted.

isSame

public static function isSame(array1:Array, array2:Array):Boolean

Compares the two arrays, whether they contain the same values at the same positions.

Parameters
array1 The first array for the comparison.
array2 The second array for the comparison.
Returns
True if the two arrays contain the same values at the same positions else false.

getItemsByType

public static function getItemsByType(items:Array, type:Class):Array

Returns all items of the given array that of the given type.

Parameters
items The array that contains the items to look in.
type The class that the items should match.
Returns
A new array with all items that match the given class.

toString

public static function toString(array:Array, separator:String = ", "):String

Returns a string from the given array, using the specified separator.

Parameters
array The array from which to return a string.
separator The array element separator.
Returns
A string representation of the given array.

CynBrowser Class

Description

The CynBrowser class contains static functions for get information about the SWFs containing HTML page including browser detection and URL manipulation. CynBrowser holds all of the JavaScript code inline inside the class to prevent needing additional files besides the class itself.

Properties

CHROME

public static const CHROME:String

Defines the value of the navigator.userAgent string for the Google Chrome Browser.

OPERA

public static const OPERA:String

Defines the value of the navigator.userAgent string for the Opera Browser.

SAFARI

public static const SAFARI:String

Defines the value of the navigator.userAgent string for the Apple Safari Browser.

MSIE

public static const MSIE:String

Defines the value of the navigator.userAgent string for the Internet Explorer Browser.

FIREFOX

public static const FIREFOX:String

Defines the value of the navigator.userAgent string for the Mozilla Firefox Browser.

SEAMONKEY

public static const SEAMONKEY:String

Defines the value of the navigator.userAgent string for the SeaMonkey Browser.

Methods

isBrowser

public static function isBrowser(browser:String):Boolean

Checks to see if the param string is the browser being used. The function adds the attempted browser name to the tested browser array using getBrowserNames.

Parameters
browser The browser string to check against.
Returns
True if the browser string matches part of navigator.userAgent string.

getQueryParam

public static function getQueryParam(param:String):String

Gets the value of the query string parameter passed in.

Parameters
param The string value of the query param.
Returns
The value of the param or a blank string.

url

public static function url(base:Boolean = false, protocol:Boolean = true):String

Returns the JavaScript window.location.href.

Returns
The url string affected by parameters.

browserName

public static function browserName():String

Gets the name of the browser by extraction from the navigator.userAgent string.

Returns
The name of the browser.

fullVersion

public static function fullVersion():String

Gets the full browser version by extraction from the navigator.userAgent string.

Returns
The full version of the browser.

majorVersion

public static function majorVersion():String

Gets only the major browser version by extraction from the navigator.userAgent string.

Returns
The major version of the browser.

userAgent

public static function userAgent():String

Gets navigator.userAgent from JavaScript.

Returns
The user agent string.

appName

public static function appName():String

Gets navigator.appName from JavaScript.

Returns
The app name string.

isChrome

public static function isChrome():Boolean

Checks whether browser is Google Chrome or not.

Returns
True if Chrome, otherwise false.

isSafari

public static function isSafari():Boolean

Checks whether browser is Apple Safari or not.

Returns
True if Safari, otherwise false.

isOpera

public static function isOpera():Boolean

Checks whether browser is Opera or not.

Returns
True if Opera, otherwise false.

isMSIE

public static function isMSIE():Boolean

Checks whether browser is Internet Explorer or not.

Returns
True if Internet Explorer, otherwise false.

isFirefox

public static function isFirefox():Boolean

Checks whether browser is Mozilla Firefox or not.

Returns
True if Firefox, otherwise false.

isSeaMonkey

public static function isSeaMonkey():Boolean

Checks whether browser is Mozilla SeaMonkey or not.

Returns
True if SeaMonkey, otherwise false.

addBrowserName

public static function addBrowserName(browser:String):Array

Adds a browser string to the browser list. This function run is every time isBrowser is run so it can check an updated list of browser strings.

Parameters
browser The browser string to be added to the browser name array.
Returns
The new list of browsers names as an array.

getBrowserNames

public static function getBrowserNames():Array

Makes a shallow copy of the browser strings that are being used for browser detection.

Returns
A copy of the browser names in the array.

CynColor Class

Description

The CynColor class contains static functions for manipulation of colors.

Methods

hex2uint

public static function hex2uint(hex:String):uint

Converts a hexidecmal string into an unsigned integer. This does the opposite of uint2hex.

Parameters
hex The hexidecmal string to convert.
Returns
An unsigned integer with a equivalent value to the hex.

uint2hex

public static function uint2hex(num:uint):String

Converts an unsigned integer into an hexidecmal string. This does the opposite of hex2uint.

Parameters
num The unsigned integer to convert.
Returns
A hex string with a equivalent value to the uint.

rgb2uint

public static function rgb2uint(r:int, g:int, b:int):uint

Converts RGB values into an unsigned integer.

Parameters
r The red value as an integer.
g The green value as an integer.
b The blue value as an integer.
Returns
An unsigned integer with a equivalent value to the RGB values passed.

hsv2uint

public static function hsv2uint(hue:Number, sat:Number, val:Number):uint

Converts HSV values to an unsigned integer.

Parameters
hue The hue value.
sat The saturation value.
val The value. This also sometimes referred to as brightness.
Returns
An unsigned integer with a equivalent value to the HSV values passed.

hsv2rgb

public static function hsv2rgb(hue:Number, sat:Number, val:Number):Object

Converts HSV values to RGB values. This does the opposite of rgb2hsv.

Parameters
hue The hue value.
sat The saturation value.
val The value. This also sometimes referred to as brightness.
Returns
A result object containing the properties r for red, g for green and b for blue.

rgb2hsv

public static function rgb2hsv(red:Number, grn:Number, blu:Number):Object

Converts RGB values to HSV values. This does the opposite of hsv2rgb.

Parameters
red The red value.
grn The green value.
blu The blue value.
Returns
A result object containing the properties h for hue, s for saturation and v for value.

CynFormat Class

Description

The CynFormat class contains static functions for formatting.

Methods

cash

public static function cash(number:Number, symbol:String = "$", frontSymbol:Boolean = true, changeSplit:String = ".", billsSplit:String = ","):String

Converts a number into a cash string.

Parameters
number The number to be converted.
symbol The currency symbol.
frontSymbol Flag to use the currency symbol or not.
changeSplit The delimiter between dollars and cents.
billsSplit The delimiter between thousands of dollars.
Returns
The cash string.

time

public static function time(seconds:Number):String

Converts seconds into formatted hours, minutes and seconds.

Parameters
seconds The seconds to be converted.
Returns
The formatted hours, minutes and seconds string.

CynNumber Class

Description

The CynNumber class contains static functions for manipulation of numbers.

Methods

decimalPlaces

public static function decimalPlaces(number:Number, precision:int):Number

Trims a floating point number to specified number of places.

Parameters
number The number to be converted.
precision The decimal precision.
Returns
The decimal number.

commaFormat

public static function commaFormat(number:Number):String

Returns a comma formatted string from a number.

Parameters
number The number to be formatted.
Returns
The comma formatted string.

addLeadingZero

public static function addLeadingZero(number:Number):String

Formats a number to include a leading zero if it is a single digit between -1 and 10.

Parameters
number The number that will be formatted.
Returns
A string with single digits between -1 and 10 padded with a leading zero.

getHighest

public static function getHighest(numbers:Array):Number

Returns the highest number in an array.

Parameters
numbers The array.
Returns
The highest number.

getLowest

public static function getLowest(numbers:Array):Number

Returns the lowest number in an array.

Parameters
numbers The array.
Returns
The lowest number.

CynObject Class

Description

The CynObject class contains static functions for getting information on objects.

Methods

getObjectName

public static function getObjectName(object:Object):String

Gets name of object similar to how toString works.

Parameters
object The object to name.
Returns
A bracketed object string name.

getObjectSuperClassName

public static function getObjectSuperClassName(object:Object):String

Gets name of the object's superclass similar to how toString works.

Parameters
object The object to name.
Returns
A bracketed object string name.

getClassName

public static function getClassName(object:Object):String

Gets the classname of the object.

Parameters
object The object to name.
Returns
A string of the class name.

getSuperClassName

public static function getSuperClassName(object:Object):String

Gets the classname of the object's superclass.

Parameters
object The object to name.
Returns
A string of the superclass name.

CynRandom Class

Description

The CynRandom class contains static functions for randomization.

Methods

arrayOfIndex

public static function arrayOfIndex(length:int = 0):Array

Returns an array of zero based indexed numbers randomly.

Parameters
length The length of the array to be generated.
Returns
The array of random numbers in length range.

arrayOfSingleDigits

public static function arrayOfSingleDigits(length:int = 0):Array

Returns an array of single digit numbers randomly.

Parameters
length The length of the array to be generated.
Returns
The array of single random numbers in length range.

numberByLength

public static function numberByLength(length:int = 0):Number

Returns a random number a specified number of digits long.

Parameters
length The length of digits to return.
Returns
The random number generated.

numberInRange

public static function numberInRange(low:Number, high:Number, integer:Boolean = true):Number

Returns a random number in range.

Parameters
low The low range.
high The high range.
integer If false, allow floating point number otherwise integer.
Returns
The random number in range generated.

CynString Class

Description

The CynString class contains static functions for manipulation of strings.

Methods

lowerCamelToTitle

public static function lowerCamelToTitle(value:String):String

Converts an lower camel case string to a string in title case.

Parameters
value The string to convert.
Returns
The converted title case string.

upperCamelToTitle

public static function upperCamelToTitle(value:String):String

Converts an upper camel case string to a string in title case.

Parameters
value The string to convert.
Returns
The converted title case string.

upperCaseFirst

public static function upperCaseFirst(value:String):String

Upper cases the first letter in the string.

Parameters
value The string to be upper cased.
Returns
The string with an uppercase first character.

replaceAll

public static function replaceAll(original:String, find:String, replace:String):String

Replaces all string matches in the string.

Parameters
original The string to search.
find The substring to find.
replace The replacement of the substring.
Returns
The edited string.

compact

public static function compact(value:String):String

Compact a string. Removes new lines, tabs and carriage returns.

Parameters
value The string to compact.
Returns
The compacted string.

trim

public static function trim(input:String):String

Removes whitespace from the front and the end of the specified string.

Parameters
input The string whose beginning and ending whitespace will be removed.
Returns
A string with whitespace removed from the begining and end.

ltrim

public static function ltrim(input:String):String

Removes whitespace from the front of the specified string.

Parameters
input The string whose beginning whitespace will will be removed.
Returns
A string with whitespace removed from the begining.

rtrim

public static function rtrim(input:String):String

Removes whitespace from the end of the specified string.

Parameters
input The string whose ending whitespace will will be removed.
Returns
A string with whitespace removed from the end.

CynValidate Class

Description

The CynValidate class contains static functions for validation. Each function can return true or false, or if passFail is set to false a result object containing valid, code and text properties is returned. Validiation codes returned by the result object are enumerated in the class.

Properties

VALID

public static const VALID:int

Code for valid.

DATE_MONTH_OUT_OF_RANGE

public static const DATE_MONTH_OUT_OF_RANGE:int

Code for date of the month being out of range.

DATE_DAY_OUT_OF_RANGE

public static const DATE_DAY_OUT_OF_RANGE:int

Code for the day being out of range.

DATE_INCORRECT_FORMAT

public static const DATE_INCORRECT_FORMAT:int

Code for date being in incorrect format.

DATE_TOO_MANY_SEPARATORS

public static const DATE_TOO_MANY_SEPARATORS:int

Code for too many separators in a date.

DATE_INCORRECT_YEAR

public static const DATE_INCORRECT_YEAR:int

Code for an incorrect year.

DATE_CANT_CONVERT_TO_DATE

public static const DATE_CANT_CONVERT_TO_DATE:int

Code for an error in conversion to date.

IP_CONTAINS_INVALID_CHARS

public static const IP_CONTAINS_INVALID_CHARS:int

Code for invalid characters in an IP address.

IP_INCORRECT_PERIODS

public static const IP_INCORRECT_PERIODS:int

Code for incorrect number of periods in an IP address.

IP_FIRST_VALUE_ZERO

public static const IP_FIRST_VALUE_ZERO:int

Code for first value in an IP being zero.

IP_PART_NOT_VALID_NUM

public static const IP_PART_NOT_VALID_NUM:int

Code for IP being not a valid number.

URL_LENGTH_INVALID

public static const URL_LENGTH_INVALID:int

Code for a URL being an invalid length.

URL_INVALID_PROTOCOL

public static const URL_INVALID_PROTOCOL:int

Code for a URL being an invalid protocol.

URL_INVALID_CHARS

public static const URL_INVALID_CHARS:int

Code for a URL having invalid characters.

URL_INVALID_DOMAIN_NAME

public static const URL_INVALID_DOMAIN_NAME:int

Code for an invalid domain name.

URL_CAN_HAVE_1_QUESTION_MARK

public static const URL_CAN_HAVE_1_QUESTION_MARK:int

Code for a URL having more than one question mark.

SSN_INVALID_CHARS

public static const SSN_INVALID_CHARS:int

Code for a social security number with invalid characters.

SSN_INVALID_FORMAT

public static const SSN_INVALID_FORMAT:int

Code for a social security number with an invalid format.

SSN_TOO_MANY_DASHES

public static const SSN_TOO_MANY_DASHES:int

Code for a social security number with too many dashes.

SSN_WRONG_LENGTH

public static const SSN_WRONG_LENGTH:int

Code for a social security number that is too long.

passFail

public static var passFail:Boolean

Flag to determine whether true of false is returned or a result object. Default is true. Switch to false to return a result object containing valid, code and text properties if the validation is more complex than true or false.

Methods

eq

public static function eq(a:*, b:*, strict:Boolean = false):Boolean

Tests to see if two objects are equal. If strict is set, then it is tested strictly with strict equality instead of just the equality operator.

Parameters
a The object.
b The compare object.
strict Flag to decide whether to test strictly.
Returns
True if the same.

uneq

public static function uneq(a:*, b:*, strict:Boolean = false):Boolean

Tests to see if two objects are not equal. If strict is set, then it is tested strictly with strict equality instead of just the equality operator.

Parameters
a The object.
b The compare object.
strict Flag to decide whether to test strictly.
Returns
True if different.

digit

public static function digit(value:String):Boolean

Casts a string as a number. If it fails, returns false.

Parameters
value The String of the number to validate.
Returns
True if the data is valid.

letter

public static function letter(value:String):Boolean

Determines if the character is within A-Z or a-z.

Parameters
value The character to validate.
Returns
True if the data is valid.

alphaNumeric

public static function alphaNumeric(value:String):Boolean

Determines whether the string contains only alphanumeric characters.

Parameters
value The string to validate.
Returns
True if the data is valid.

letterOrDigit

public static function letterOrDigit(value:String):Boolean

Determines whether the character is a letter or a number.

Parameters
value The character to validate.
Returns
True if the data is valid.

socialSecurity

public static function socialSecurity(value:String):Object

Checks to see if the string is a valid Social Security Number. Valid examples are 111-11-1111 or 111111111.

Parameters
value The string that will be validated.
Returns
True, false or a result object.

urlSecure

public static function urlSecure(value:String):Object

Performs basic checks to determine if a string is a valid HTTPS URL.

Parameters
value The string containing the HTTPS URL.
Returns
True, false or a result object.

url

public static function url(value:String, ssl:Boolean = false):Object

Performs basic checks to determine if a string is a valid HTTP or HTTPS URL.

Parameters
value The string containing the URL.
isSSL A boolean value that is set to true for HTTPS URL.
Returns
True, false or a result object.

ip

public static function ip(value:String):Object

Determine whether a string is a valid IP address.

Parameters
value The string containing the IP address.
Returns
True, false or a result object.

validChars

public static function validChars(value:String, chars:String):Boolean

Compare a string against a list of characters to determine if the string contains only those characters. This comparison is not case-sensitive and does not validate the order of the characters.

Parameters
value The string that needs to be validated.
chars The list of valid characters for that string.
Returns
True if the data is valid.

worldDate

public static function worldDate(value:String):Object

Determines whether the string contains a valid day-first format date.

Parameters
value The string containing a date in a day-first format.
Returns
True if the date is a valid day-first date.

date

public static function date(value:String, dayFirst:Boolean = false):Object

Determines if the string contains a valid date. Valid examples include 9/30/09, 9-30-09 or 9.30.09.

Parameters
value The String containing the date.
dayFirst Whether the date is in a day first format.
Returns
True, false or a result object.

integerInRange

public static function integerInRange(value:String, min:int, max:int):Boolean

Determines whether the integer with a specified range.

Parameters
value The string representing the number to validate.
min The minimum value as a number (>= comparison).
max The maxium value as a number (<= comparison).
Returns
True if the data is within the range.

notEmpty

public static function notEmpty(value:String, white:Boolean = false):Boolean

Determines whether the string contains data.

Parameters
value The character to validate.
white A boolean when set to false will ignore white space (space, newline, tab).
Returns
True if the string is not empty.