13 Replies Latest reply: Aug 8, 2011 1:34 AM by hsu.shan.chuang RSS

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

    gauravk.pandey

      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

        • 1. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
          robin.briggs Adobe Employee

          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

          • 2. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
            gauravk.pandey Community Member

            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

            • 3. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
              robin.briggs Adobe Employee

              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

              • 4. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                gauravk.pandey Community Member

                Thanks Robin fro ur help i got the error i was using the old API now i have

                solved this but can there is any document that enlist the API for the new

                TLF changes

                • 5. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                  robin.briggs Adobe Employee

                  Glad you got it working!

                   

                  If you build the build.xml that comes with TLF, it will build the docs for you. You can do this using Ant. The docs for TLF are not posted online yet.

                   

                  Thanks!

                   

                  - robin

                  • 6. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                    Alan Stearns Adobe Employee

                    You can also get the documentation for a particular Flex SDK 4 build under the "Language Reference" links here:

                     

                    http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

                     

                    This will include the docs for the TLF build that SDK uses.

                    • 7. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                      Nitika_Ag

                      Hi Gaurav,

                       

                      How were you able to solve that problem... "" 1046: Type was not found...:ImportExportConfiguration""

                       

                      I want to shift my project from flex SDK 3.5 to 4.0 and m facing this error.

                       

                      Were you earlier working in flex 3.5.

                       

                      Help

                       

                       

                       

                      Regards,

                      Nitika Agarwal

                      • 8. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                        gauravk.pandey Community Member

                        Hi Nikita,

                         

                        Sry for the delayed response, there is two possibility for that:

                        1. If you using Flex  Builder

                        •   Then put your sdk uncompressed folder in your flex builder sdk/ directory path, do one thing also first remove your flex sdk 3.5 from /sdk folder of flex bulder refrenced your flex 4 sdk as a default sdk and cleane your Flex builder from run , and write following command:

                              path of your flex bulder exe //pro file/adobe... put a space and write -cleane option

                         

                         

                        • Also check your fash player it must target flash player 10.
                        • go to adobe site how to extrenally point flash player 10, since there is a good tutorial there so i wont write it.


                        After error removed put back your removed sdk 3.5 to it's original location

                         

                        2. If you using flash builder 4 then no need to do all the above exercise just change the Flex sdk version(if point flex sdk 3.5 ) to sdk 4.0.

                         

                        Hope above solve your problem.

                        FAny further query or suggestion is most welcome

                         

                        Regards,

                        Gaurav Kumar Pandey

                        • 9. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                          singh.dhruv

                          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

                          • 10. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                            robin.briggs Adobe Employee

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

                             

                            Thanks,

                             

                            - robin

                            • 11. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                              hsu.shan.chuang

                              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 ! 

                              • 12. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                                gauravk.pandey Community Member

                                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

                                • 13. Re: Type was not found or was not a compile-time constant: ImportExportConfiguration
                                  hsu.shan.chuang Community Member

                                  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[i].fontName, data: fonts[i].fontName});
                                      //trace( fonts[i].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 !