Skip to main content
Known Participant
February 25, 2010
Answered

Type was not found or was not a compile-time constant: ImportExportConfiguration

  • February 25, 2010
  • 4 replies
  • 13703 views

Hi,

     I am using text layout framework and getting an error type was not found or was not a compile-time constant: ImportExportConfiguration. I am using Flex Builder 3 , Flex SDK version flex_sdk_4.0.0.10485 and flash player 10.0.12 , Surprisingly this error not located in my project workspace.

In my code i uses

import flashx.textLayout.container.DisplayObjectContainerController;

    

Help

Thanks

Gaurav kumar Pandey

This topic has been closed for replies.
Correct answer robin_briggs

You are using an older version of our code. I suggest you update to the latest code, see: http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK.

You don't need to use the Flex Framework, but it comes with the latest textLayout libraries and source code.

Hope this helps,

- robin

4 replies

August 8, 2011

It still can't work ! I use Flash CS5 and sdk is 4.0.In publish setting it have textLayout.swc and flex.swc form path of lib.When I add  TextConverter.export(..),it show Error 1046: Type was not found or was not a compile-time constant: importExportConfiguration.My code as flow :


package
{

import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.IParagraphFormat;
import flashx.textLayout.formats.ParagraphFormat;
import flashx.textLayout.formats.ICharacterFormat;
import flashx.textLayout.formats.CharacterFormat;
import flashx.textLayout.formats.IContainerFormat;
import flashx.textLayout.formats.ContainerFormat;
import flashx.textLayout.formats.TextAlign;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.UndoManager;
import flashx.textLayout.edit.ElementRange;
import flashx.textLayout.edit.IEditManager;
import flashx.textLayout.events.StatusChangeEvent;
import flashx.textLayout.events.SelectionEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.ui.Keyboard;
import flash.text.Font;
import flash.geom.Rectangle;
import flashx.textLayout.conversion.ConversionType;
import flash.events.MouseEvent;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.container.ContainerController;
import fl.events.ColorPickerEvent;
import fl.motion.Color;
import flash.geom.ColorTransform;


public class SimpleEditor extends MovieClip
{

  private var _textFlow:TextFlow;
        private var testFlow:TextFlow;

  public function SimpleEditor ()
  {

   TextFlow.defaultConfiguration.noFocusSelectionFormat = TextFlow.defaultConfiguration.focusSelectionFormat;
   //initWidgets ();
   //initStage ();
  
   var loader:URLLoader = new URLLoader();
   loader.load (new URLRequest("SimpleText.xml"));
   loader.addEventListener (Event.COMPLETE, loadCompleteHandler);
   }

         //
private function loadCompleteHandler (e:Event):void
  {
   myTextLayout.xmlText = e.target.data;
   initTextFlow ();
 
  }
       //
       private function initTextFlow ():void
  {
   _textFlow = myTextLayout.textFlow;
            _textFlow.addEventListener (StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED, graphicChanged);
   _textFlow.addEventListener (SelectionEvent.SELECTION_CHANGE,selectionChangeListener,false,0,true);
   
   _textFlow.flowComposer.updateAllContainers ();
   
   _textFlow.interactionManager.setSelection (0,0);
   _textFlow.interactionManager.setFocus ();
  
  
  var xmlOut:XML = TextConverter.export(_textFlow,TextConverter.TEXT_LAYOUT_FORMAT,ConversionType.XML_TYPE) as XML;
  }

       private function initWidgets ():void
  {
   populateFontFamily ();
   direction.addEventListener (Event.CHANGE, changeDirection);
   blockprogression.addEventListener (Event.CHANGE, changeBlockProgression);
   verticalalign.addEventListener (Event.CHANGE, changeVerticalAlign);
   columngap.addEventListener (KeyboardEvent.KEY_UP, changeColumnGap);
   columncount.addEventListener (KeyboardEvent.KEY_UP, changeColumnCount);
   textindent.addEventListener (KeyboardEvent.KEY_UP, changeTextIndent);
   textalign.addEventListener (Event.CHANGE, changeTextAlign);
   lineheight.addEventListener (KeyboardEvent.KEY_UP, changeLineHeight);
   fontsize.addEventListener (KeyboardEvent.KEY_UP, changeFontSize);
   fontfamily.addEventListener (Event.CHANGE, changeFontFamily);
   btnItalic.addEventListener (MouseEvent.CLICK, changeFontItalic);
   btnBold.addEventListener (MouseEvent.CLICK, changeFontBold);  
   fromPicker.addEventListener (ColorPickerEvent.CHANGE, changeColor);

  }
 
  private function initStage ():void
  {
   stage.scaleMode = StageScaleMode.NO_SCALE;
   stage.align = StageAlign.TOP_LEFT;
   stage.addEventListener (Event.RESIZE, resizeHandler);
  }
      //
      private function populateFontFamily ():void
  {
   // try to add fonts to the drop down
   var fonts:Array = Font.enumerateFonts(true);
   fonts.sortOn ("fontName", Array.CASEINSENSITIVE);
   for (var i:int = 0; i< fonts.length; i++)
   {
    fontfamily.dataProvider.addItem ({label: fonts.fontName, data: fonts.fontName});
    //trace( fonts.fontName);
   }
  }
      
    private function graphicChanged (sce:StatusChangeEvent):void
  {
   _textFlow.flowComposer.updateAllContainers();
   
  }

  private function selectionChangeListener (e:SelectionEvent):void
  {
   // set display according to the values at the beginning of the selection range
   var paragraphFormat:IParagraphFormat = e.selectedElementRange.paragraphFormat;
   var characterFormat:ICharacterFormat = e.selectedElementRange.characterFormat;
   var containerFormat:IContainerFormat = e.selectedElementRange.containerFormat;

   // update the different comboboxes so their selectedItem matches the current selection
   updateComboBox (fontfamily, characterFormat.fontFamily);// font family
   updateComboBox (textalign, paragraphFormat.textAlign);// text alignment
   updateComboBox (verticalalign,containerFormat.verticalAlign);// vertical alignment
   updateComboBox (blockprogression,_textFlow.computedContainerFormat.blockProgression);// block progressions
   updateComboBox (direction,_textFlow.getComputedColumnDirection());// direction

   // update the different text input entries
   fontsize.text = characterFormat.fontSize.toString();// font size
   lineheight.text = characterFormat.lineHeight.toString();// line height
   textindent.text = paragraphFormat.textIndent.toString();// indentation
   columncount.text = containerFormat.columnCount.toString();// number of columns
   columngap.text = containerFormat.columnGap.toString();// gaps/gutter width
   
   //TextConverter.export(_textFlow,TextConverter.TEXT_LAYOUT_FORMAT,ConversionType.XML_TYPE);
  
  }


  private function updateComboBox (box:ComboBox,val:String):void
  {
   for (var i:int = 0; i < box.dataProvider.length; i++)
   {
    if (box.dataProvider.getItemAt(i).data == val)
    {
     box.selectedIndex = i;
     return;
    }
   }
   box.text = val;
  }
//
  private function changeFontFamily (e:Event):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var cf:CharacterFormat = new CharacterFormat();
    cf.fontFamily = ComboBox(e.currentTarget).selectedItem.data;
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }
  private function changeFontSize (ke:KeyboardEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager && ke.keyCode == Keyboard.ENTER)
   {
    var cf:CharacterFormat = new CharacterFormat();
    cf.fontSize = TextInput(ke.currentTarget).text;
    
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
   //TextConverter.export(_textFlow,TextConverter.TEXT_LAYOUT_FORMAT,ConversionType.XML_TYPE);
  }
  //
  private function changeFontItalic (e:MouseEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var cf:CharacterFormat = new CharacterFormat();
    cf.fontStyle="italic";    
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }
  //
  private function changeFontBold (e:MouseEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var cf:CharacterFormat = new CharacterFormat();
    cf.fontWeight="bold";       
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }
  //

  private function changeColor (e:ColorPickerEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var clipTransform:ColorTransform=new ColorTransform();
               
    var cf:CharacterFormat = new CharacterFormat();
    clipTransform.color=fromPicker.selectedColor;

             
    cf.color=clipTransform.color;
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
    
   }
  }
  //
  private function changeLineHeight (ke:KeyboardEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager && ke.keyCode == Keyboard.ENTER)
   {
    var cf:CharacterFormat = new CharacterFormat();
    cf.lineHeight = TextInput(ke.currentTarget).text;
    IEditManager(_textFlow.interactionManager).applyCharacterFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeTextAlign (e:Event):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var pf:ParagraphFormat = new ParagraphFormat();
    pf.textAlign = ComboBox(e.currentTarget).selectedItem.data;
    IEditManager(_textFlow.interactionManager).applyParagraphFormat (pf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeTextIndent (ke:KeyboardEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager && ke.keyCode == Keyboard.ENTER)
   {
    var pf:ParagraphFormat = new ParagraphFormat();
    pf.textIndent = TextInput(ke.currentTarget).text;
    IEditManager(_textFlow.interactionManager).applyParagraphFormat (pf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeColumnCount (ke:KeyboardEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager && ke.keyCode == Keyboard.ENTER)
   {
    var cf:ContainerFormat = new ContainerFormat();
    cf.columnCount = TextInput(ke.currentTarget).text;

    IEditManager(_textFlow.interactionManager).applyContainerFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeColumnGap (ke:KeyboardEvent):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager && ke.keyCode == Keyboard.ENTER)
   {
    var cf:ContainerFormat = new ContainerFormat();
    cf.columnGap = TextInput(ke.currentTarget).text;
    IEditManager(_textFlow.interactionManager).applyContainerFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeVerticalAlign (e:Event):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var cf:ContainerFormat = new ContainerFormat();
    cf.verticalAlign = ComboBox(e.currentTarget).selectedItem.data;
    
    IEditManager(_textFlow.interactionManager).applyContainerFormat (cf);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function changeBlockProgression (e:Event):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var cf:ContainerFormat = new ContainerFormat();
    cf.blockProgression = ComboBox(e.currentTarget).selectedItem.data;
    IEditManager(_textFlow.interactionManager).applyFormatToElement (_textFlow,null,null,cf);
    _textFlow.interactionManager.setFocus ();
   }
  }


  private function changeDirection (e:Event):void
  {
   if (_textFlow && _textFlow.interactionManager is IEditManager)
   {
    var pf:ParagraphFormat = new ParagraphFormat();
    pf.direction = ComboBox(e.currentTarget).selectedItem.data;
   
    IEditManager(_textFlow.interactionManager).applyFormatToElement (_textFlow,null,pf,null);
    _textFlow.interactionManager.setFocus ();
   }
  }

  private function resizeHandler (e:Event):void
  {
   
   myTextLayout.width = stage.stageWidth - myTextLayout.x;
   myTextLayout.height = stage.stageHeight - myTextLayout.y;

  
   _textFlow.flowComposer.getControllerAt(0).container.parent.scrollRect = new Rectangle(0,0,myTextLayout.width,myTextLayout.height);
  }
}
}

Did the problem had old version of flex sdk or not import lib or textLayout component not suppose TextConverter.export() class ? please help me, I have source code to download test.My e-mail : hsu.shan.chuang@gmail.com ,tks !

August 5, 2011

I have same problem with can't use  TextConverter.importToFlow(...) , it show "type was not found or was not a compile-time constant: ImportExportConfiguration".My lib have a textLayout.swc component and I use it,my code as flow :

import .... ;

public class SimpleEditor extends MovieClip
{

  private var _textFlow:TextFlow;
     

  public function SimpleEditor ()
  {

    
   var loader:URLLoader = new URLLoader();
   loader.load (new URLRequest("SimpleText.xml"));
   loader.addEventListener (Event.COMPLETE, loadCompleteHandler);
   }

  //
  private function loadCompleteHandler (e:Event):void
  {
  _textFlow = TextConverter.importToFlow( e.target.data,TextConverter.TEXT_FIELD_HTML_FORMAT);
  }

}

why ? if I delete  textLayout.swc  from my lib, it can work ! 

Known Participant
August 5, 2011

hi,

What I am guseeyou uses Flex4 sdk with your application and your lib folder contain older version of textlayout.swc. Once you removed this swc from lib folder your code will point textlayout.swc from Flex 4 sdk folder, and when you have older version of textlayout.swc in your lib folder your code will target to that swc .

Hope you get the answer .Happy programming with TextLayoutFramework.

Regards,

Gaurav Pandey

Participant
July 21, 2011

hi,

I got same issue but in custome componets.

like:

Type was not found or was not a compile-time constant: spinner

Type was not found or was not a compile-time constant: winprogress

Is any one know why this happen ?

dhruv

Adobe Employee
August 4, 2011

I don't think these are TLF errors. Can you tell me what you're trying to build?

Thanks,

- robin

robin_briggsCorrect answer
Adobe Employee
February 25, 2010

You are using an older version of our code. I suggest you update to the latest code, see: http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK.

You don't need to use the Flex Framework, but it comes with the latest textLayout libraries and source code.

Hope this helps,

- robin

Known Participant
February 26, 2010

Thanks Robin,

    I have solved the problem but fall under the new problem what i did used the sdk version flex_sdk_4.0.0.6175 and it shows a new prblem Severity and Description    Path    Resource    Location    Creation Time    Id
1046: Type was not found or was not a compile-time constant: [flashx.textLayout.elements]::ITextLineCreator.      

plese help me

Thanks and regards ,

Gaurav kumar pandey

Adobe Employee
March 2, 2010

Can you tell me what is the code you are trying to run? You have TLF, and you are trying to run it with some code. Can you tell me what that code is? Does it work with a very simple example? ITextLineCreator is an old API, that is not present in the new code. But if you are trying to run TLF with some old example code, that could explain your difficulty.

Thanks,

- robin