Using Squiggly in Flash CS5

假装没事ソ 提交于 2019-12-13 09:26:13

问题


This is going to seem quite a lame question - basically we have downloaded a package called Squiggly - http://labs.adobe.com/technologies/squiggly/ - and we are trying to implement it into Flash (using AS3, CS5). And none of us are very good at flash, and have no clue how to do it, the actionscript in the .as is as follows:

package
{
    import flash.display.Sprite;

    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.edit.EditManager;

    import com.adobe.linguistics.spelling.SpellUIForTLF;

    public class SquigglyTLFExample extends Sprite
    {
        public function SquigglyTLFExample()
        {
            var markup:XML = <TextFlow xmlns='http://ns.adobe.com/textLayout/2008'><p><span>I know &nbsp;</span><span fontStyle='italic'>Enlish</span><span>. Use the context menu to see the suggestions of the missbelled word.</span></p></TextFlow>;
            var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);
            textFlow.flowComposer.addController(new ContainerController(this, 500, 600));
            textFlow.flowComposer.updateAllControllers();

            textFlow.interactionManager = new EditManager();

            SpellUIForTLF.enableSpelling(textFlow, "en_US");
        }
    }
}

I have a blank swf, and just want to know how to implement it to a text area. Why do people still use flash? :(


回答1:


Here's how I got it running in a new FLA file in Flash CS 5:

1) In Flash, go into 'Advanced Actionscript 3.0 Settings' and change to the Librarys path tab on the middle of that pane.

2) Add the AdobeSpellingUITLF.swc.

3) When the SWC has been added, select it in the list and click the little 'I'-icon(when you hover it, it should say: 'Set linkage options for a library').

Change the link type to 'Merged into code'.

4) Add the code you posted (SquigglyTLFExample) as your Document class.

5) Remember to copy the 'AdobeSpellingConfig.xml' and the 'dictionaries'-folder to the same folder as the generated SWF-file.

The configuration in Flash should look something like this:




回答2:


i have built a class based on squiggle a while ago: http://apdevblog.com/actionscript-spell-checking-with-squiggly-as3-only-and-flash-9-compatible/

it's very easy to use and compatible with normal textfields >flash9.

cheers



来源:https://stackoverflow.com/questions/6790154/using-squiggly-in-flash-cs5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!