Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

actionscript 3 - Using Squiggly in Flash CS5

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? :(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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: How to properly setup the, ActionScript, Squiggly TLF Example in Flash CS 5


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...