Static
applyCopy the values of properties in aValues to properties of same name in anObject.
If a property of aValue is an object, the function will copy all the properties in that object.
If the value of a property of aValue is a function, the function will be called with two parameters: anObject, property name. The function is responsible for assigning a value to anObject.
Object to update properties
Object to get parse and obtain values from
Value of anObject
var errorProperties: Object = {
textField: {
borderColor: 0xFF0000,
backgroundColor: 0xFFCCCC
}
};
// backup current properties
var originalProperties: Object = UFObjectTools.backupProperties(SomeTextInput, errorProperties);
// show error state
UFObjectTools.applyProperties(SomeTextInput, errorProperties);
// restore original settings
UFObjectTools.applyProperties(SomeTextInput, originalProperties);
Static
backupCreate a copy of the map object, setting properties in it to values of properties in aSource.
aMap can contain properties with basic types or properties of type Object. In that case the object properties are scanned.
If aSource is an Array instance, a new Array instance is created else a new Object instance is used.
Source object to obtain values from
An object with various properties
A copy of aMap with values obtained from a Source.
make copy of some properties in TextInput
<listing>
var map = Object = {
text: 'some text',
textField: {
borderColor: 0xFF0000,
backgroundColor: 0xFFCCCC
}
};
var data: Object = UFObject.backupProperties(SomeTextInput, map);
// data.text = text of SomeTextInput
// data.textField.borderColor = current border color of SomeTextInput
// data.textField.backgroundColor = current background color
</listing>
Static
combineCombines multiple object instances.
The method will create a new object and copies all properties (including getters and setters) from each argument to the new object.
After processing all arguments, the method checks each argument again if it contains the initialize method specified by anInitMethod.
If aCallInit is true, the initialize method gets called using the newly created object as its function scope.
If aCallInit is false, a new initialize method is attached to the created object that will call all the other initialize methods with the correct function scope.
Object instances to combine
When false do not call the initialize methods but create and attach a new initialize method that will call the initialize methods (if any of the other objects contains the initialize method).
The name of the initialize method to call or null to skip.
An instance being a combination of all arguments
Static
containsChecks if an object contains a certain key. It is possible to specify multiple values.
An object (keys are checked)
Rest
...aKeys: string[]One or more key names to check
True if the object has a key that matches one of the aKeys values.
Static
copyCopies a property/method from one object to another. If the property is a getter or setter, the method will redefine the property in the target object.
Name of property
Source to copy property from
Target to copy property to
Static
deepStatic
equalSee if all properties in aMatch can be found in aSource and are equal. If a property is an object, the method will call itself recursively.
Only properties defined in aMatch are checked.
Source object to test
Contains properties to match
True: ignore case of string properties, false: casing must match for properties to be equal
True: all properties found and matching in value
Static
getStatic
getGets a property from an object and typecast it to a type.
Object to get property from
Property to get
Default value to use
value from property or aDefault if it does not exist
Static
getStatic
getStatic
getGets a property as a certain type or throws an error if the property is missing.
Object to get property from
Property to get
value of property
an error if the object does not contain the property
Static
instanceChecks if an object is an instance of a class. If anObject is not an object, the method will return false.
The method will also return false if instanceOf fails with an exception.
Object to check
Class to check
True if anObject is an instance of aClass; in all other cases false.
Static
setStatic
set
UFObject implements various support methods for objects.