与FlashDevelop一起使用TextLayout时出错

时间:2009-10-08 18:29:48

标签: actionscript-3

当我在flash开发中使用textLyout库资产时  我没有发现此错误: 我的所有代码:

  

`包   {       import flash.display.Sprite;       import flash.display.StageAlign;       import flash.display.StageScaleMode;
      import flashx.textLayout.container.DisplayObjectContainerController;       import flashx.textLayout.conversion.ImportExportConfiguration;       import flashx.textLayout.conversion.TextFilter;       import flashx.textLayout.edit.EditManager;       import flashx.textLayout.elements.Configuration;       import flashx.textLayout.elements.TextFlow;       import flashx.textLayout.formats.CharacterFormat;       import flashx.textLayout.formats.TextDecoration;

public class Main01 extends Sprite
{
    static private const markup:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' fontSize='14' textIndent='15' marginBottom='15' paddingTop='4' paddingLeft='4'" + 
            "tabStops='alignment:start, position:100; alignment:start, position:200; alignment:start, position:300; alignment:start, position:400; alignment:start, position:500; alignment:start, position:600; alignment:start, position:700'>" + 
            "<p>The following excerpt is from " + 
            "<a href='http://www.4literature.net/Nathaniel_Hawthorne/Ethan_Brand/'>" + 
            "<span>Ethan Brand</span></a> by " + 
            "<a href='mailto:nathaniel_hawthorne@famousauthors.com'><span>Nathaniel Hawthorne</span></a>.</p>" + 
            "<p><span>There are many </span><span fontStyle='italic'>such</flow:span><flow:span> lime-kilns in that tract of country, for the purpose of burning the white marble which composes a large part of the substance of the hills. Some of them, built years ago, and long deserted, with weeds growing in the vacant round of the interior, which is open to the sky, and grass and wild-flowers rooting themselves into the chinks of the stones, look already like relics of antiquity, and may yet be overspread with the lichens of centuries to come. Others, where the lime-burner still feeds his daily and nightlong fire, afford points of interest to the wanderer among the hills, who seats himself on a log of wood or a fragment of marble, to hold a chat with the solitary man. It is a lonesome, and, when the character is inclined to thought, may be an intensely thoughtful occupation; as it proved in the case of Ethan Brand, who had mused to such strange purpose, in days gone by, while the fire in this very kiln was burning.</flow:span></flow:p><flow:p><flow:span>The man who now watched the fire was of a different order, and troubled himself with no thoughts save the very few that were requisite to his business. At frequent intervals, he flung back the clashing weight of the iron door, and, turning his face from the insufferable glare, thrust in huge logs of oak, or stirred the immense brands with a long pole. Within the furnace were seen the curling and riotous flames, and the burning marble, almost molten with the intensity of heat; while without, the reflection of the fire quivered on the dark intricacy of the surrounding forest, and showed in the foreground a bright and ruddy little picture of the hut, the spring beside its door, the athletic and coal-begrimed figure of the lime-burner, and the half-frightened child, shrinking into the protection of his father's shadow. And when again the iron door was closed, then reappeared the tender light of the half-full moon, which vainly strove to trace out the indistinct shapes of the neighboring mountains; and, in the upper sky, there was a flitting congregation of clouds, still faintly tinged with the rosy sunset, though thus far down into the valley the sunshine had vanished long and long ago.</flow:span></flow:p></flow:TextFlow>";

    public function Main01()
    {    
        stage.scaleMode = StageScaleMode.NO_SCALE;
        stage.align = StageAlign.TOP_LEFT;


        var imExConfig:ImportExportConfiguration = new ImportExportConfiguration();
        var config:Configuration = imExConfig.defaultConfiguration.textFlowConfiguration;           
        config.manageTabKey = true;           
        var ca:CharacterFormat = new CharacterFormat();
        ca.fontSize = 24;
        ca.color = '#ff0000';
        ca.textDecoration=TextDecoration.UNDERLINE;
        config.linkInitialLinkFormat = ca;
        var textFlow:TextFlow = TextFilter.importToFlow(markup, TextFilter.TEXT_LAYOUT_FORMAT);
        textFlow.flowComposer.addController(new DisplayObjectContainerController(this, stage.stageWidth, stage.stageHeight));
        textFlow.flowComposer.updateAllContainers();            
        textFlow.interactionManager = new EditManager();
    }

}

}`

当这段代码运行时,flash develop generet这个错误:

  

C:\Documents and Settings\arjmand\My Documents\flash develop project\textLayout\sam 03\src\Main01.as(32): col: 28 Error: Type was not found or was not a compile-time constant: ImportExportConfiguration. var imExConfig:ImportExportConfiguration = new ImportExportConfiguration(); ^ C:\Documents and Settings\arjmand\My Documents\flash develop project\textLayout\sam 03\src\Main01.as(32): col: 60 Error: Call to a possibly undefined method ImportExportConfiguration. var imExConfig:ImportExportConfiguration = new ImportExportConfiguration(); ^ C:\Documents and Settings\arjmand\My Documents\flash develop project\textLayout\sam 03\src\Main01.as(42): col: 20 Error: Access of possibly undefined property linkInitialLinkFormat through a reference with static type flashx.textLayout.elements:Configuration. config.linkInitialLinkFormat = ca; ^ C:\Documents and Settings\arjmand\My Documents\flash develop project\textLayout\sam 03\src\Main01.as(45): col: 53 Error: Implicit coercion of a value of type flashx.textLayout.container:DisplayObjectContainerController to an unrelated type flashx.textLayout.container:ContainerController. textFlow.flowComposer.addController(new DisplayObjectContainerController(this, stage.stageWidth, stage.stageHeight)); ^ C:\Documents and Settings\arjmand\My Documents\flash develop project\textLayout\sam 03\src\Main01.as(46): col: 35 Error: Call to a possibly undefined method updateAllContainers through a reference with static type flashx.textLayout.compose:IFlowComposer. textFlow.flowComposer.updateAllContainers(); ^ Build halted with errors (fcsh).

2 个答案:

答案 0 :(得分:0)

可能将-target-player = 10添加到编译器命令字符串

答案 1 :(得分:0)

我使用flex sdk 4并将目标flash播放器设置为10