<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:cHc="cHc.*"
    layout="absolute" width="502" height="390" clipContent="false"
    creationComplete="init()">
    
    <mx:Script>
        <![CDATA[
            private function init():void
            {
                rte.toolbar.removeChild(rte.linkTextInput);    
                rte.toolbar.addChild(rteCharSelector);      
                
                rteCharSelector.targetText = rte;
                taCharSelector.targetText = ta;
                tiCharSelector.targetText = ti;         
            }
        ]]>
    </mx:Script>
    
    <mx:RichTextEditor id="rte" x="10" y="10" title="Foreign/Unicode Character Entry" width="295" height="186"/>
    <mx:TextArea id="ta" x="197" y="304" width="295" height="46"/>
    <mx:TextInput id="ti" x="197" y="358" width="251"/>
    
    <cHc:CharacterSelector id="rteCharSelector" singleSelect="{ckSingle.selected}"/>
    <cHc:CharacterSelector id="taCharSelector" x="456" y="328" singleSelect="{ckSingle.selected}" alpha="0.2"/>
    <cHc:CharacterSelector id="tiCharSelector" x="456" y="358" singleSelect="{ckSingle.selected}"/>
    <mx:Text x="313" y="10" text="The CharacterSelector is simply added to a form and associated with the control it should add characters to." width="179" height="65"/>
    <mx:Text x="313" y="83" text="By adding one to the toolbar of the RichTextEditor, the user gets a simple, natural way to add foreign characters to their text." width="179" height="83"/>
    <mx:Text x="10" y="304" text="While not as natural as being placed in a toolbar, the CharacterSelector can easily be associated with TextArea and TextInput controls as well." width="179" height="76"/>
    <mx:CheckBox x="161.5" y="236" label="Single Character Selection" id="ckSingle"/>
    
</mx:Application>