Skip to main content
April 29, 2010
Question

Text Layout Framework

  • April 29, 2010
  • 1 reply
  • 2057 views

hi

i installed Flash builder 4 in my system and eclipse plugin.

this is my source code

Action script file

package components
{
    import flashx.textLayout.container.DisplayObjectContainerController;
    import flashx.textLayout.conversion.TextFilter;
    import flashx.textLayout.elements.TextFlow;
   
    import mx.collections.ArrayCollection;
    import mx.controls.ComboBox;
    import mx.core.mx_internal;
    import mx.events.FlexEvent;
    import mx.events.ListEvent;
   
    use namespace mx_internal;
   

     public class CustomComboBox extends ComboBox
     {
          private var _textFlow:TextFlow;
        private var containerController:DisplayObjectContainerController;
        private var _selectedLabel:String = '';
       
        //Property which contain the Arabic String in ArrayCollection
        public var _customLabelField:String = 'customString';
       
       
          public function CustomComboBox()
          {
               super();
               addEventListener(ListEvent.CHANGE, changeHandler);
               addEventListener(FlexEvent.VALUE_COMMIT,changeHandler);
          }
 
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            if(selectedItem)
            {
               // TODO: allow a String to be the data object, and hide the label so [object Object] doesn't appear
                 if(selectedItem && selectedItem[_customLabelField])
                 {
                     if(!containerController)
                      {
                          var txtXML:XML = XML('<TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><div direction="rtl"><p>'+selectedItem[_customLabelField]+'</p></div></TextFlow>');
                          _textFlow = TextFilter.importToFlow(txtXML, TextFilter.TEXT_LAYOUT_FORMAT);
                          containerController = new DisplayObjectContainerController(textInput, this.width-20, this.height);
                          _textFlow.flowComposer.addController(containerController);
                          _textFlow.flowComposer.updateAllContainers();
                          _selectedLabel = selectedItem[_customLabelField];
                      }
                }
            }
            textInput.move(-10, 5);
        }
       
        public function get customLabelField():String
        {
            return _customLabelField;
        }
       
        public function set customLabelField(value:String):void
        {
            _customLabelField = value;
        }
       
        override public function set dataProvider(value:Object):void
        {
            //Reset the 'label' property to empty string
            for(var i:int = 0; i < (value as ArrayCollection).length; i++)
                (value as ArrayCollection).getItemAt(i).label = '';
           
            super.dataProvider = value;
        }
       
        //It will return the selected item displaying text
        public function get SelectedLabel():String
        {
            return _selectedLabel;
        }
       
        private function changeHandler(event:Object):void
        {
           
            var txtXML:XML = XML('<TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><div direction="rtl"><p>'+selectedItem[_customLabelField]+'</p></div></TextFlow>');
             if(txtXML && containerController)
             {
                 _textFlow = new TextFlow();
                _textFlow = TextFilter.importToFlow(txtXML, TextFilter.TEXT_LAYOUT_FORMAT);
                 _textFlow.flowComposer.addController(containerController);
                 _textFlow.flowComposer.updateAllContainers();
                 _selectedLabel = selectedItem[_customLabelField];
             }
        }
}
}

This is my mxml file
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:components="components.*">
    <!--Use the property 'customLabel' to populate indian or other language Text-->
    <components:CustomButton id="tbn" customLabel="यह हिन्दी है" width="300" label="aaa"/>
    <mx:HBox>
        <mx:Button label="Hindi" click="{tbn.customLabel = 'यह हिन्दी है'}"/>
        <mx:Button label="Telugu" click="{tbn.customLabel = 'ఇది తెలుగు'}"/>
    </mx:HBox>
</mx:Application>

i use the flex sdk4  and i execute this program the error is following
type not found are not a compile time constant


    [mxmlc] Loading configuration file C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\flex-config.xml
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:FXGImporter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs\textLayout_conversion.swc(flashx.textLayout.conversion:FXGExporter)
    [mxmlc] Error: Type was not found or was not a compile-time constant: ImportExportConfiguration.

BUILD FAILED
pls help me
This topic has been closed for replies.

1 reply

Adobe Employee
April 29, 2010

It looks like you are mixing the original beta prerelease of over a year ago with the current software.  Some of

the classes you list (DisplayObjectContainerController for example) are long gone and replaced.

You'll want to get the current documentation and remove any out of date textLayout related swcs you are including in your project.

Current docs are here:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

Hope that helps,

Richard

April 30, 2010

hi

i use the flex sdk 4.1.0. but i can't import the  t flashx.textLayout.container.DisplayObjectContainerController and

flashx.textLayout.conversion.TextFilter. So i put the files textLayout_conversion and textLayout_core.
Now i can import the TextFilter and DisplayObjectContainerController.
but i cant  create the object of TextFilter and DisplayObjectcontainercontrloller and TextFilter.
    containerController = new DisplayObjectContainerController(comp, this.width, this.height);
   _textFlow = TextFilter.importToFlow(txtXML, TextFilter.TEXT_LAYOUT_FORMAT);

the same error occured.
  [mxmlc] Loading configuration file C:\Program Files\Adobe\Adobe

Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\
flex-config.xml
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs
\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-timeconstant: ImportExportConfiguration.
    [mxmlc] C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\4.1.0\frameworks\libs
\textLayout_conversion.swc(flashx.textLayout.conversion:TextFilter)
    [mxmlc] Error: Type was not found or was not a compile-timeconstant: ImportExportConfiguration.

could you help me

regards

athi

April 30, 2010

DisplayObjectContainerController and TextFilter are classes from the old, outdated code that is not compatible with the up-to-date version of TLF you'll find in Flex SDK 4.1. They have been replaced with ContainerController and TextConverter.

Remove the old textLayout_conversion and textLayout_core (and trash all copies you have), take a look at the documentation and update your code to the shipping version of TLF.