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 |
ROOT
public static function get ROOT():DisplayObject
Returns the root of the application. Attempts
at setting will throw an |
FLASH_VARS_VO
public static function get FLASH_VARS_VO():FlashVarsVO
Returns FlashVars as a value object. Attempts
at setting will throw an |
DEBUGGER
public static function get DEBUGGER():Debugger
Returns the debugger instance. The debugger has one function, |
MODEL
public static function get MODEL():CynModel
Returns the extended |
CONTROLLER
public static function get CONTROLLER():CynController
Returns the extended |
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 |
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.
|
||||||||
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
|
||||||||
go
public static function go(url:String, target:String):void
Goes to a webpage.
|
||||||||
addCynViewProxy
public static function addCynViewProxy(view:DisplayObject):void
Adds a view to the framework that cannot extend
|
||||||||
removeCynViewProxy
public static function removeCynViewProxy(view:DisplayObject):void
Removes a proxy view from notifications from the controller.
|
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.
|
||||||||||
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
|
||||||||||
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
|
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 |
cynController
protected var cynController:CynController
A reference to the |
suppressDebug
protected var suppressDebug:Boolean
Flag to set whether debugging is suppressed for this |
describeProperties
protected var describeProperties:Array
List of properties to describe on the view when using |
| 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.
|
||||||
debug
protected function debug(message:Object):void
Traces out a debugging message.
|
||||||
addListener
public function addListener(type:String, listener:Function, props:Object = null):void
Shorthand method for
|
||||||
addWeakListener
public function addWeakListener(type:String, listener:Function):void
Shorthand method for
|
||||||
removeListener
public function removeListener(type:String):void
Shorthand method for
|
||||||
removeAllChildren
public function removeAllChildren():Array
Removes all children of the
|
||||||
removeAllListeners
public function removeAllListeners():void
Removes all the listeners added. |
||||||
getListeners
public function getListeners():Array
Returns a copy of the listeners on the
|
||||||
describeListeners
public function describeListeners(compact:Boolean = true):String
Returns a valid JSON string describing the listeners.
|
||||||
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
|
||||||
resize
public function resize(vo:ResizeVO):void
Invoked when
|
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 |
| Methods | ||||
|---|---|---|---|---|
execute
public function execute(handle:String, vo:CyntaxicVO):void
Executes a controller function based on the string value of the handle parameter.
|
||||
notify
public function notify(handle:String, vo:CyntaxicVO):void
Notifies
|
||||
debug
protected function debug(message:Object):void
Traces out a debugging message.
|
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
|
||||||
addAt
public function addAt(view:CynView, index:int, props:Object = null):CynView
Adds a child
|
||||||
remove
public function remove(view:CynView, completely:Boolean = false):CynView
Removes a child of the
|
||||||
removeAt
public function removeAt(index:int, completely:Boolean = false):CynView
Removes a child of the
|
||||||
removeSelf
public function removeSelf(event:Event = null):CynView
Removes itself using the
|
||||||
destroy
public function destroy(view:CynView):void
Destroys a child of the
|
||||||
destroyAt
public function destroyAt(index:int):void
Destroys a child of the
|
||||||
destroySelf
public function destroySelf(event:Event = null):CynView
Destroys itself using the
|
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
|
||
remove
public static function remove(view:DisplayObject):void
Removes a proxy view from notifications from the controller.
|
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.
|
||
getProp
public function getProp(prop:String):Object
Gets a property value by its property name.
|
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.
|
||||
copyShuffle
public static function copyShuffle(array:Array):Array
Shuffles an array without shuffling the original.
|
||||
clone
public static function clone(array:Array):Array
Clones an array.
|
||||
removeItem
public static function removeItem(array:Array, item:*):Array
Removes all occurances of a the given item out of the array.
|
||||
removeLastOccurance
public static function removeLastOccurance(array:Array, item:*):Number
Removes the last occurance of the given item out of the array.
|
||||
removeFirstOccurance
public static function removeFirstOccurance(array:Array, item:*):Number
Removes the first occurance of the given item out of the array.
|
||||
isSame
public static function isSame(array1:Array, array2:Array):Boolean
Compares the two arrays, whether they contain the same values at the same positions.
|
||||
getItemsByType
public static function getItemsByType(items:Array, type:Class):Array
Returns all items of the given array that of the given type.
|
||||
toString
public static function toString(array:Array, separator:String = ", "):String
Returns a string from the given array, using the specified separator.
|
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 |
OPERA
public static const OPERA:String
Defines the value of the |
SAFARI
public static const SAFARI:String
Defines the value of the |
MSIE
public static const MSIE:String
Defines the value of the |
FIREFOX
public static const FIREFOX:String
Defines the value of the |
SEAMONKEY
public static const SEAMONKEY:String
Defines the value of the |
| 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
|
||
getQueryParam
public static function getQueryParam(param:String):String
Gets the value of the query string parameter passed in.
|
||
url
public static function url(base:Boolean = false, protocol:Boolean = true):String
Returns the JavaScript
|
||
browserName
public static function browserName():String
Gets the name of the browser by extraction from the
|
||
fullVersion
public static function fullVersion():String
Gets the full browser version by extraction from the
|
||
majorVersion
public static function majorVersion():String
Gets only the major browser version by extraction from the
|
||
userAgent
public static function userAgent():String
Gets
|
||
appName
public static function appName():String
Gets
|
||
isChrome
public static function isChrome():Boolean
Checks whether browser is Google Chrome or not.
|
||
isSafari
public static function isSafari():Boolean
Checks whether browser is Apple Safari or not.
|
||
isOpera
public static function isOpera():Boolean
Checks whether browser is Opera or not.
|
||
isMSIE
public static function isMSIE():Boolean
Checks whether browser is Internet Explorer or not.
|
||
isFirefox
public static function isFirefox():Boolean
Checks whether browser is Mozilla Firefox or not.
|
||
isSeaMonkey
public static function isSeaMonkey():Boolean
Checks whether browser is Mozilla SeaMonkey or not.
|
||
addBrowserName
public static function addBrowserName(browser:String):Array
Adds a browser string to the browser list. This function run is every time
|
||
getBrowserNames
public static function getBrowserNames():Array
Makes a shallow copy of the browser strings that are being used for browser detection.
|
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
public static function uint2hex(num:uint):String
Converts an unsigned integer into an hexidecmal string. This does the
opposite of
|
||||||
rgb2uint
public static function rgb2uint(r:int, g:int, b:int):uint
Converts RGB values into an unsigned integer.
|
||||||
hsv2uint
public static function hsv2uint(hue:Number, sat:Number, val:Number):uint
Converts HSV values to an unsigned integer.
|
||||||
hsv2rgb
public static function hsv2rgb(hue:Number, sat:Number, val:Number):Object
Converts HSV values to RGB values. This does the opposite
of
|
||||||
rgb2hsv
public static function rgb2hsv(red:Number, grn:Number, blu:Number):Object
Converts RGB values to HSV values. This does the opposite
of
|
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.
|
||||||||||
time
public static function time(seconds:Number):String
Converts seconds into formatted hours, minutes and seconds.
|
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.
|
||||
commaFormat
public static function commaFormat(number:Number):String
Returns a comma formatted string from a number.
|
||||
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.
|
||||
getHighest
public static function getHighest(numbers:Array):Number
Returns the highest number in an array.
|
||||
getLowest
public static function getLowest(numbers:Array):Number
Returns the lowest number in an array.
|
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
|
||
getObjectSuperClassName
public static function getObjectSuperClassName(object:Object):String
Gets name of the object's superclass similar to how
|
||
getClassName
public static function getClassName(object:Object):String
Gets the classname of the object.
|
||
getSuperClassName
public static function getSuperClassName(object:Object):String
Gets the classname of the object's superclass.
|
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.
|
||||||
arrayOfSingleDigits
public static function arrayOfSingleDigits(length:int = 0):Array
Returns an array of single digit numbers randomly.
|
||||||
numberByLength
public static function numberByLength(length:int = 0):Number
Returns a random number a specified number of digits long.
|
||||||
numberInRange
public static function numberInRange(low:Number, high:Number, integer:Boolean = true):Number
Returns a random number in range.
|
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.
|
||||||
upperCamelToTitle
public static function upperCamelToTitle(value:String):String
Converts an upper camel case string to a string in title case.
|
||||||
upperCaseFirst
public static function upperCaseFirst(value:String):String
Upper cases the first letter in the string.
|
||||||
replaceAll
public static function replaceAll(original:String, find:String, replace:String):String
Replaces all string matches in the string.
|
||||||
compact
public static function compact(value:String):String
Compact a string. Removes new lines, tabs and carriage returns.
|
||||||
trim
public static function trim(input:String):String
Removes whitespace from the front and the end of the specified string.
|
||||||
ltrim
public static function ltrim(input:String):String
Removes whitespace from the front of the specified string.
|
||||||
rtrim
public static function rtrim(input:String):String
Removes whitespace from the end of the specified string.
|
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. |
EMAIL_INVALID_CHARS
public static const EMAIL_INVALID_CHARS:int
Code for an email having invalid characters. |
EMAIL_CAN_HAVE_1_AT_SIGN
public static const EMAIL_CAN_HAVE_1_AT_SIGN:int
Code for email having more than one @ sign. |
EMAIL_USERNAME_BLANK
public static const EMAIL_USERNAME_BLANK:int
Code for an email with a blank username. |
EMAIL_INVALID_DOMAIN
public static const EMAIL_INVALID_DOMAIN:int
Code for an email with an invalid domain. |
EMAIL_INVALID_DOMAIN_EXT
public static const EMAIL_INVALID_DOMAIN_EXT:int
Code for an email with an invalid extension. |
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.
|
||||||
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.
|
||||||
digit
public static function digit(value:String):Boolean
Casts a string as a number. If it fails, returns false.
|
||||||
letter
public static function letter(value:String):Boolean
Determines if the character is within A-Z or a-z.
|
||||||
alphaNumeric
public static function alphaNumeric(value:String):Boolean
Determines whether the string contains only alphanumeric characters.
|
||||||
letterOrDigit
public static function letterOrDigit(value:String):Boolean
Determines whether the character is a letter or a number.
|
||||||
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.
|
||||||
public static function email(value:String):Object
Determines whether a string is an email address. Checks for common email address formats but it does not support the full RFC definition.
|
||||||
urlSecure
public static function urlSecure(value:String):Object
Performs basic checks to determine if a string is a valid HTTPS URL.
|
||||||
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.
|
||||||
ip
public static function ip(value:String):Object
Determine whether a string is a valid IP address.
|
||||||
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.
|
||||||
worldDate
public static function worldDate(value:String):Object
Determines whether the string contains a valid day-first format 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.
|
||||||
integerInRange
public static function integerInRange(value:String, min:int, max:int):Boolean
Determines whether the integer with a specified range.
|
||||||
notEmpty
public static function notEmpty(value:String, white:Boolean = false):Boolean
Determines whether the string contains data.
|