SparkRichTextEditor is a flex component based on Text Layout Framework with basic functionality implementation of a simple text editor with styles and key shortcuts with advances and improvements of new text system of Adobe.
Click with the right button to obtain source code.
More great examples of Adobe TLF and from tlftexteditor (in Google Code).
- Use a BBDD manager like Lita para administrar los datos cómodamente.
- Salt in the encryption increase security but link password to the machine. Library as3corelib generate password with salt stored in the Encrypted Local Store
(ELS - C:\Users\{user}\AppData\Roaming\Adobe\AIR\ELS) for each application. Using this salt there is a random value part of the password to increase security. Use Base64 to make password transportable.
- Use as3corelib and salt doesn’t allow copy (attach) a BBDD with as3corelib password. Better change-operate-restore password.
- Use métodoconnection.attach to open each databases and copy each other. If there are problems of integrity “malformed database” can be corrected using a non-admin Lita . (Use SharpPlus SQLite Developer to delete problems with triggers)
- Runtime errors
- If you are using as3corelib be careful because the same string generates different keys in different applications.
Useful links:
Using the encrypted local store feature
Using encryption with SQL databases
Strategies for working with SQL databases
Function to register keyboadr events easily and reference them to a handle function.
It allow to apply keyboard shortcuts using any key combination.
registerKey({component}, [Keyboard.CONTROL, Keyboard.TAB], {function}, true);
/**
* Register, capture and manage keys event for each component
*
* @param target Component whit key events to manage
* @param shortcuts Array of keyBoard codes to apply shortcuts
* @param handle Function that process key event
* @param param Boolean to indicate if return event param
*
*/
public static function registerKey (target:UIComponent,
shortcuts:Array, handle:Function, returnParam:Boolean=true):void {
var keys:Array = new Array();
target.addEventListener(KeyboardEvent.KEY_DOWN,
function (event:KeyboardEvent):void {
if (keys.indexOf(event.keyCode) == -1) {
keys.push(event.keyCode);
}
if (keys.length == shortcuts.length) {
var result:Boolean = true;
for each (var shortcut:int in shortcuts) {
if (keys.indexOf(shortcut) == -1) {
result = false;
break;
}
}
if (result) {
if (returnParam) {
handle.call(target, event);
} else {
handle.call(target);
}
event.preventDefault();
}
}
});
// Remove key on keyUp
target.addEventListener(KeyboardEvent.KEY_UP,
function (event:KeyboardEvent):void {
var index:int = keys.indexOf(event.keyCode);
if (index != -1) {
keys.splice(index,1);
}
});
// Remove all keys saved to return to initial state on 'focus in'
target.addEventListener(FocusEvent.FOCUS_OUT,
function (event:FocusEvent):void {
keys = new Array();
});
}
There is a trick to redim automatically, based on relative width, Spark Datagrid columns:
private const DATAGRID_SCROLL:int = 16;
[Bindable]
private var scrollGap:int = DATAGRID_SCROLL;
<s:DataGrid id="dt" width="100%" height="100%" ...>
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="title" headerText="MyTitle"
width="{(dt.scroller.verticalScrollBar.visible==true)
? (dt.width-DATAGRID_SCROLL)*0.47
: (dt.width-scrollGap)*0.47}">
</s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
Example of re-ordering over a Datagrid Spark with Drag&Drop.
Click with the right button to obtain source code.
Alex’s Flex Closet show other example of Drag and Drop with Spark Datagrid component.