blob: f5c1b5049733f2a717799e83b39697fadb11e556 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!---
* @exampleText The following ConfigExample MXML demonstrates the use of ResourceTable.setResource method and SpellingConfiguration class.
* Note that the results from this example may differ based on dictionary file.
*
* The following steps are taken:
* <ol>
* <li>Create a <code>ResourceTable</code> object.</li>
* <li>Map different locales with their resources using <code>ResourceTable.setResource</code> method </li>
* <li>Set <code>SpellingConfiguration.resourceTable</code> equal to the resource table object created above.</li>
* <li>Create some text areas and call<code> SpellUI.enableSpelling</code> method for spell check.</li>
* <li>Spell check is now done using resource set by resource table and AdobeSpellingConfig.xml is ignored.</li>
* </ol>
*
* Note: to make this example work properly, please make sure you have the proper dictionary file in the specified folder
* and put the Squiggly library(AdobeSpellingFramework.swc and AdobeSpellingUI.swc) in your libs folder. Please see the reference "How to generate Squiggly dictionary".
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" viewSourceURL="srcview/index.html" applicationComplete="init()">
<mx:Script>
<![CDATA[
import com.adobe.linguistics.spelling.SpellUI;
import com.adobe.linguistics.spelling.framework.SpellingConfiguration;
import com.adobe.linguistics.spelling.framework.ResourceTable;
public function init():void
{
var resourceTable:ResourceTable = new ResourceTable();
resourceTable.setResource("en_US", {rule:"data/en_US.aff", dict:"data/en_US.dic"});
resourceTable.setResource("es_ES", {rule:"data/es_ES.aff", dict:"data/es_ES.dic"});
SpellingConfiguration.resourceTable = resourceTable;
}
public function spellEnglish():void
{
SpellUI.enableSpelling(ta_en,"en_US");
}
public function spellSpanish():void
{
SpellUI.enableSpelling(ta_es,"es_ES");
}
]]>
</mx:Script>
<mx:Label text="ConfigExample.mxml Spell checks using SpellingConfiguration class. Does not need AdobeSpellingConfig.xml" fontSize="20"/>
<mx:TextArea id="ta_en" width="50%" height="20%"
text="I know Enlish. Use the context menu to see the suggestions of the missbelled word. " />
<mx:Button label="Spell English" id="b1" click="spellEnglish()"/>
<mx:TextArea id="ta_es" width="50%" height="20%"
text="Sé esbañol. Utilice el menú contextual para ver las sugerencias de la palabra mal eskrita. " />
<mx:Button label="Spell Spanish" id="b2" click="spellSpanish()"/>
</mx:Application>