TLF Problems

Hi all,
New here in this forum...
I'm not sure if this is the right place for my question.
I've recently updated my Flash CS5 (Flash Professional CS5 Update 11.0.2 09/07/2010). It seems like it has a bug in the TLF.
I have a little chat app. When ever the user adds another message i create a new ParagraphElement and add it to a TextFlow object(the same one, a private member). It always shows only one line of text, even when there should be 2 or more lines.
Here is the code:
package chat.messageProcessor{
     import flash.display.DisplayObject;
     import flash.display.Sprite;
     import flash.events.EventDispatcher;
     import flashx.textLayout.container.ContainerController;
     import flashx.textLayout.conversion.ConversionType;
     import flashx.textLayout.conversion.TextConverter;
     import flashx.textLayout.edit.SelectionManager;
     import flashx.textLayout.elements.InlineGraphicElement;
     import flashx.textLayout.elements.ParagraphElement;
     import flashx.textLayout.elements.SpanElement;
     import flashx.textLayout.elements.TextFlow;
     import flashx.textLayout.events.CompositionCompleteEvent;
     import flashx.textLayout.events.FlowOperationEvent;
     import flashx.textLayout.events.SelectionEvent;
     import flashx.textLayout.operations.CopyOperation;
      * @author Shlomi Bittan
     public class MessageConverter extends EventDispatcher{
          private static const IMO_CHAR:String = "[i]";
          private var _textFlow:TextFlow;
          private var _paragraph:ParagraphElement;
          private var _link:LinkElement
          private var _selectionManager:SelectionManager;
          private var _textFlowSelection:TextFlow;
          private var _container:Sprite;
          private var _containerController:ContainerController;
          private var _initialWidth:Number;
          private var _initialHeight:Number;
          public function MessageConverter() {
               _textFlow = new TextFlow();
               _selectionManager = new SelectionManager();
               _textFlow.interactionManager = _selectionManager;
               _textFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, onFlowOperationEvent);
               _textFlow.addEventListener(CompositionCompleteEvent.COMPOSITION_COMPLETE, onCompositionCompleteEvent);
               _textFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, selectionHandler);
          private function onCompositionCompleteEvent(event:CompositionCompleteEvent):void {
               trace("onCompositionCompleteEvent, num children:" + _textFlow.numChildren);
               trace("onCompositionCompleteEvent, last child height:" + _textFlow.getChildAt(_textFlow.numChildren - 1).getTextFlow().flowComposer.getControllerAt(0).container.height);
          private function selectionHandler(event:SelectionEvent):void {
               trace(event.selectionState.absoluteStart);
               var selectedText:String = _textFlow.getText(event.selectionState.absoluteStart, event.selectionState.absoluteEnd)
               _textFlowSelection = TextConverter.importToFlow(selectedText, TextConverter.PLAIN_TEXT_FORMAT);
          private function onFlowOperationEvent(event:FlowOperationEvent):void {
               if (event.operation is CopyOperation) {
                    event.preventDefault();
                    var copyOperation:CopyOperation = event.operation as CopyOperation;
                    var convertedTextFlowXML:XML = TextConverter.export(_textFlowSelection, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.XML_TYPE) as XML;
                    convertedTextFlowXML.ignoreWhitespace = true;
                    trace(convertedTextFlowXML);
          public function addText(text:String):void {
               _container = new Sprite();
               _paragraph = new ParagraphElement();
               analizeText(text, _paragraph);
               _textFlow.addChild(_paragraph);
          public function appendImageURL(url:String):void {
          public function appendImage(image:DisplayObject):void {
          public function addImageAt(index:uint, image:DisplayObject):void {
          public function removeFirstMessage():void {
               _textFlow.removeChild(_textFlow.getChildAt(0));
               _textFlow.flowComposer.updateAllControllers();
          public function getTextFlow():TextFlow {
               return _textFlow;
          public function create(initialWidth:Number, initialHeight:Number):Sprite {
               trace("create, initialHeight:" + initialHeight);
               _containerController = new ContainerController(_container, _initialWidth, _initialHeight);
               _textFlow.flowComposer.addController(_containerController);
               _textFlow.flowComposer.updateAllControllers();
               _textFlow.flowComposer.updateAllControllers();
               return _container;
          private function analizeText(text:String, paragraph:ParagraphElement):void {
               if (text.indexOf(MessageConverter.IMO_CHAR) > -1) {
                    var messageArray:Array = text.split(MessageConverter.IMO_CHAR);
                    for (var i:int = 0; i < messageArray.length; i++){
                         var span:SpanElement = new SpanElement();
                         span.text = messageArray[i];
                         paragraph.addChild(span);
                         if (i < messageArray.length - 1) {
                              var inlineGraphicElement:InlineGraphicElement = new InlineGraphicElement();
                              inlineGraphicElement.id = MessageConverter.IMO_CHAR;
                              inlineGraphicElement.paddingLeft = 10;
                              inlineGraphicElement.paddingRight = 10;
                              inlineGraphicElement.source = "http://www.sweetwaterwildcatfever.com/i/clipart/clipart_animals_cats_025.gif";
                              inlineGraphicElement.width = 16;
                              inlineGraphicElement.height = 16;
                              paragraph.addChild(inlineGraphicElement);
               }else {
                    var span1:SpanElement = new SpanElement();
                    span1.text = text;
                    paragraph.addChild(span1);

Thanks fopgames.
Is this what you mean: _textFlow.multiline = true;
I must add the there is no TLFTextField instance in use.

Similar Messages

  • Flex 4 Tlf Problem! How to get active Paragraph?!

    I have following TLF XML:
    private var text:XML =
    <flow:TextFlow fontSize="20" paddingRight="50" paddingBottom="50" paddingTop="50" paddingLeft="50" whiteSpaceCollapse="preserve" xmlns:flow="http://ns.adobe.com/textLayout/2008">
            <flow:p>
                     <flow:span>Hallo liebers Programmili... du tust schon langsam meinem koepchen weh</flow:span>
            </flow:p>
    </flow:TextFlow>;
    I try to get the Paragraph for a selection inside the text using following Methodes:
    var index:int = tf.interactionManager.anchorPosition; // i get 29 here
    var child:FlowElement = tf.getChildAtIndex(index); // undefined - it should be the flowElement containing the text... <flow:span></flow:span>
    var para:ParagraphElement = test.getParagraph();//undefined - it should be the paragraph
    I really started to enjoy the new framework... but now i am getting really mad
    Can anybody imagine what i am doing wrong? The undefined itself makes me suspicious... shouldn't it be null?
    Help would be much appriciated!

    I just saw i posted this into the wrong thread... reopend the topic at
    http://forums.adobe.com/thread/568455
    Thx so far!

  • TLF problem with flex_sdk_4.0.0.10485

    Hi All,
    I have just written a simple As class using flex builder3 and flex_sdk_4.0.0.10485 surprisingly it shows a dozen of errors
         my simple class is
      package {
        import flash.display.Sprite;
        import flashx.textLayout.compose.StandardFlowComposer;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.elements.ParagraphElement;
        import flashx.textLayout.elements.SpanElement;
        import flashx.textLayout.elements.TextFlow;
        public class HelloWorld extends Sprite
            public function HelloWorld()
                var textFlow:TextFlow = new TextFlow();
                var p:ParagraphElement = new ParagraphElement();
                textFlow.addChild(p);
                var span:SpanElement = new SpanElement();
                span.text = "Hello, World";
                span.fontSize = 48;
                p.addChild(span);
                textFlow.flowComposer.addController(new ContainerController(this, 400, 200));
                textFlow.flowComposer.updateAllControllers();
    the error lis in Flex builder:
    Severity and Description    Path    Resource    Location    Creation Time    Id
    1084: Syntax error: expecting rightbrace before BusyCursor.        DemoTLF    line 17    1267524161015    177
    1084: Syntax error: expecting rightbrace before end of program.        DemoTLF    line 53    1267524161015    178
    1084: Syntax error: expecting rightparen before s.        DemoTLF    line 17    1267524161000    174
    1093: Syntax error.        DemoTLF    line 17    1267524161000    175
    1094: Syntax error: A string literal must be terminated before the line break.        DemoTLF    line 17    1267524161015    176
    I did'nt get whats going wrong any help would be highly appriceated

    By default it will use the SDK that comes with Flex Builder, you will need to add the new SDK, and select it as your target Flex SDK, if you haven't already. That will ensure that it is using the correct version of the compiler when it builds. I don't remember exactly how this is done, but I think if you select "Preferences" there will be an option, perhaps under "ActionScript" for installing the Flex SDK. I would suggest checking to make sure this is done.

  • TextFlow and Controller Being Created Too Early?

    I've successfully rolled my work with the TextFlow into a
    Canvas component, made it into an SWC, and made that part of the
    application it was originally designed for. No problems. Alright,
    now time to re-use my work in another app. that could benefit from
    a rich text component. Went through the usual motions and got all
    of my UI for my text component to render except the TextFlow!
    Then what I discovered is when I resized the browser window
    that hosting my Flex app, the cascade of resize events got the
    TextFlow to finish rendering, the scroll bars got adjusted
    properly, and it was ready to accept input with the blinking
    cursor.
    Here is a dump from some trace statements I have in my code,
    I'm trying to work out the order in which events are happening and
    when the text flow gets proper measurements:
    Composer -> Resize -> New TextFlow Dimensions -> W:
    0 H: 0
    Composer -> Creating Display Controller -> TextFlow
    Dimensions -> W: 754 H: 0
    Composer -> Created
    MessageEditorBase -> Created
    MessageEditorBase -> Event Fired -> Resize
    MessageEditorBase -> Event Fired -> Show
    Composer -> Resize -> New TextFlow Dimensions -> W:
    754 H: 0
    MessageEditorBase -> Event Fired -> Resize
    Composer -> Resize -> New TextFlow Dimensions -> W:
    1328 H: 274
    MessageEditorBase -> Event Fired -> Resize
    Composer -> Resize -> New TextFlow Dimensions -> W:
    1328 H: 275
    MessageEditorBase -> Event Fired -> Resize
    Composer -> Resize -> New TextFlow Dimensions -> W:
    1329 H: 276
    MessageEditorBase -> Event Fired -> Resize
    Composer -> Resize -> New TextFlow Dimensions -> W:
    1334 H: 277
    MessageEditorBase -> Event Fired -> Resize
    Composer -> Resize -> New TextFlow Dimensions -> W:
    1350 H: 279
    "MessageEditorBase" is a canvas (used as a tab) that gets
    displayed to the user. Within that Canvas are lots of components
    including the "Composer" which is basically a toolbar of elegant
    buttons and format functions, and then a blank canvas which holds a
    UIComponent and becomes the DisplayObjectController. Works great in
    my other app, the code is nearly line for line with Adobe's
    examples.
    Notice how it starts 0,0; then gets a width measurement of
    754; finally when I the user resize the entire application do the
    rest of the proper dimensions get computed.
    I don't think it's a TextFlow problem, but I can't say I
    understand the Flex rendering hierarchy enough to have implemented
    TextFlow and its controller in the right way with this app.
    Any thoughts? If you need more information just ask and I'll
    try to explain as best as possible.

    As it turns out with a lot of fiddling and trace statements,
    I figured out a way to initialize the DisplayObjectController with
    valid pixel values. In your TLF examples, the developers always
    created a display object controller using specific dimensions, like
    250 x 250. But I need my text component to be created dynamically
    based on the screen size of the user. This was not happening
    correctly after I upgraded to TLF build 370, though it's not even a
    TLF problem.
    I took the measurements from the parent canvas. For whatever
    strange reason, in the world of measuring Flex components, the
    child canvas further down in the application, the one that I added
    the sprite to, was not getting measured out correctly. Thus when I
    passed the controller width and height values from this child, they
    were 0.
    I hope that made sense, but either way, problem fixed.
    Edit:
    Here's an example of my code using a custom controller that
    had the keyDown event overriden:
    theController = new
    ComposerDisplayController(uiFlowComponent, uiTextArea.width,
    uiTextArea.height, this);
    I passed values which I expected the UI to measure out rather
    than me providing explicit pixel values. I had a problem when the
    UI gave me zero.

  • Problem with TLF - floating an inline image

    I am running the latest version of Flash Builder 4 (4.0.1).  The problem that I having:
    When I use an InlineGraphicsElement if aTextFlow (in a RichEditableText component), if I set a value for the "float" attribute of an <img> element; the image is not visible.  Without the float attribute, I see the image.
    Is this a version problem with TLF?  How do I know which version of TLF that I'm using?  How do I install the correct version of TLF?
    Thanks for the help.
         Oz
    Some code fragments:
    The TextFlow string with "float":
    <div color="#444444" fontFamily="Times New Roman" fontSize="20" paragraphSpaceAfter="15" textIndent="10">
    <p><span color="0xff0000" >Alice, </span><span>really, was </span><span color="0xff0000" >beginning </span><span>to </span><span color="0xff00" >get very </span><span>tired of </span><span color="0xff00" >sitting </span><span>by her </span><span color="0xff00" >sister </span><span>on the </span><span color="0xff00" >bank, </span><span>and of </span><span color="0xff00" >having nothing </span><span>to do:  once or twice she had peeped into the book her </span><span color="0xff00" >sister </span><span>was reading, but it had no </span><span color="0x888800" >pictures </span><span>or </span><span color="0xffff" >conversations </span><span>in it, `and what is the use of a book,' thought </span><span color="0xff0000" >Alice `</span><span>without </span><span color="0x888800" >pictures </span><span>or </span><span color="0xff00" >conversation?'</span></p>
    <p>
    <img float="left" width="100" source="assets/library/alice/images/White Rabbit.png" height="100"/>
    <span>So she was </span><span color="0xffff" >considering </span><span>in her own mind</span><span>(</span><span>as well as she could, for the hot day made her feel </span><span color="0xff00" >very </span><span>sleepy and stupid), whether the pleasure of making a daisy-chain would be </span><span color="0x880000" >worth </span><span>the trouble of getting up and picking the daisies, when suddenly a White </span><span color="0xff00" >Rabbit </span><span>with pink eyes ran close by her.</span></p>
    </div>
    Without "float":
    <div color="#444444" fontFamily="Times New Roman" fontSize="20" paragraphSpaceAfter="15" textIndent="10">
    <p><span color="0xff0000" >Alice, </span><span>really, was </span><span color="0xff0000" >beginning </span><span>to </span><span color="0xff00" >get very </span><span>tired of </span><span color="0xff00" >sitting </span><span>by her </span><span color="0xff00" >sister </span><span>on the </span><span color="0xff00" >bank, </span><span>and of </span><span color="0xff00" >having nothing </span><span>to do:  once or twice she had peeped into the book her </span><span color="0xff00" >sister </span><span>was reading, but it had no </span><span color="0x888800" >pictures </span><span>or </span><span color="0xffff" >conversations </span><span>in it, `and what is the use of a book,' thought </span><span color="0xff0000" >Alice `</span><span>without </span><span color="0x888800" >pictures </span><span>or </span><span color="0xff00" >conversation?'</span></p>
    <p>
    <img width="100" source="assets/library/alice/images/White Rabbit.png" height="100"/>
    <span>So she was </span><span color="0xffff" >considering </span><span>in her own mind</span><span>(</span><span>as well as she could, for the hot day made her feel </span><span color="0xff00" >very </span><span>sleepy and stupid), whether the pleasure of making a daisy-chain would be </span><span color="0x880000" >worth </span><span>the trouble of getting up and picking the daisies, when suddenly a White </span><span color="0xff00" >Rabbit </span><span>with pink eyes ran close by her.</span></p>
    </div>
    A bit of MXML code:
        <s:Group id="myGroup" width="100%" height="100%">
            <s:RichEditableText id="myRichText" lineBreak="toFit">
            </s:RichEditableText>
            <!--- Do not set the height of the RichEditableText - since it seems to prevent the appearance of the vertical scroll bars -->
        </s:Group>
    And some Actionscript that adds components:
                scroller = new SxScroller();
                scroller.dx = dxScroller;
                scroller.dy = dyScroller;
                scroller.addEventListener(FlexEvent.CREATION_COMPLETE,scrollerEvent);
                scroller.addEventListener(FlexEvent.UPDATE_COMPLETE,scrollerEvent);
                richText = scroller.richText;
                richText.editable = false;  // textCharacter.enableEdit; // probably false.  TODO:  support true???
                richText.selectable = true; // required
                richText.width = dxRichText;
    And finally the import of a TextFlow string:
    richText.textFlow = TextFlowUtil.importFromString(textFlowString, WhiteSpaceCollapse.PRESERVE);

    On the TextFlow forum I found the answer:
    Use Flash Builder Hero, since it support TLF 2.0 out-of-the-box.  The InlineGraphics support several valuable attributes, including float="left" etc.
    Beautiful.

  • Kerning/Letterspacing Problems with TLF - and more

    Hello,
    I have some troubles with TLF (RichEditableText - editable) and Letterspacing/Kerning.
    Problem is, that I my application uses a different rendering-engine on the server-side. Textediting happens with a Flash/Flex Client displaying serverside stored layouts, mass-printing/spoolfile generating again is being done on the server side.
    Now Text looks terrible  (currently most annoying when using Verdana , size 10pt). Even when typing the same word twice letterspacing of the two words looks (and is by one Pixel) diffferent.
    I could life with some differences happening here and there but the Layout and resulting Paragraph height it is a complete mess. Word wrapping accours on different words in almost every line compared to the serverside template-document.
    Last hope is that I am doing things wrong.
    Is this correct: 10 point fontsize equals 10 pixel fontsize in Flash (as flash.system.Capabilities always says DPI is 72)?
    Fonts being used are embedded in MXML style declaration.
    Thanks for any help
    Regards
      Andreas

    The server side rendering engine is a complex system wich produces multiple output formats like PDF, AFP, PCL and so on using own and 3rd Pary Modules. Resulting (printed) Documents do always match each other. I know, that there can be slight differences resulting in an unwanted Linebreak.
    But in the TLF output almost nothing looks like it should - it just does not match the template (screenrendering own C# Windows Textengine) or the print output. It is not about pixel, it's such a huge difference, sadly resulting in additional lines:
    Picture shows Text in our Design Tool (Windows .NET Application)  - Text is Verdana (regular/bold) 10pt
    TLF Version - FontFamily "Verdana", Font-Size: 10
    Same Text layouted in Word 2007 matching exaktly our Layout-Tool.
    Typing twice I ment typing the same word in tlf editor.
    Charspace between "M" and "ü" differs between 3 and 4 pixel, the same happens with "ü" and "l" - which is not a pretty look as you can see in the image.
    Regards
      Andreas

  • Problem with getting word count in TLF text

    Hi,
    I want to get the word count from my TLF text, but the problem is that I am not being able to handle th case for space.
    I am using the findNextWordBoundary property of ParagraphElement as shown below:
    private function countWords( para : ParagraphElement ) : void
                var wordBoundary:int = 0;
                var prevBoundary:int = 0;
                while ( wordBoundary != para.findNextWordBoundary( wordBoundary ) )
                   // If the value is greater than 1, then it's a word, otherwise it's a space.
                    if ( para.findNextWordBoundary( wordBoundary ) - wordBoundary > 1)
                        wordCount += 1;                   
                    prevBoundary = wordBoundary;
                    wordBoundary = para.findNextWordBoundary( wordBoundary );                   
                    // If the value is greater than 1, then it's a word, otherwise it's a space.
                    if ( wordBoundary - prevBoundary > 1 )
                        var s:String = para.getText().substring( prevBoundary, wordBoundary );
                        lenTotal += s.length;
    Now I have 2 issues here:
    If my string is for eg: Hi, I am writing in "TLF". And I want to get its word count then
    1) Suppose I take the case of the string Hi,  . Then para.getText().substring( prevBoundary, wordBoundary ) gives the text as Hi i.e without the comma. Same case for the string "TLF forums" , It treats each " as a single word and not the whole "TLF" as a single word. Why doesn't it compute till spaces, that should be the ideal case. So until we don't give a space it should count the whole thing as a word.
    2) So now the problem is I have applied a condition   if ( wordBoundary - prevBoundary > 1 ) to check if it is a space i.e. if the diff is <= 1 it is a Space. But if I use this I miss out on single words. Like for eg if I have "Hi, This is a string" ,then 'a' is ignored too.
    Now I could have added a check here along with the space check that the string between prevBoundary and wordBoundary is " "(i.e a space), Then also it is a problem as then the single words like a,&,I will be ignored.
    So, now I am stuck with this issue and need some help from you guys.
    Thanks

    findNextWordBoundary is not going to serve your purpose.  I'd propose doing something like this:
    // didn't test this but something like this - whitespace matches any set of 1 or more white space characters
    static const whiteSpaceRegExp:RegExp = /[u0020|u000A|u000D]*/
    public static function countWords( para : ParagraphElement ) : void
         return para.getText().split(whiteSpaceRegExp).length;
    A good list of everything considered whitespace extracted from the unicode space can be found here:
    http://sourceforge.net/adobe/tlf/svn/449/tree/trunk/textLayout/src/flashx/textLayout/utils /CharacterUtil.as
    In function createWhiteSpaceObject
    Hope that helps,
    Richard

  • Container TLF text problem!

    Hello,
    I want to copy this text paragraph from notepad (img1) and paste into a TLF container with 2 columns (img2), but it seems that something is wrong. Please look at the second picture and if anyone has any idea how to solve this problem?

    I figured it out, eventually.

  • Arabric Font embed, and TLF use problem.

    Hi all,
    I meet a problem with embed the Arabric Font.
       [Embed(source="fonts/axtyoumn.TTF",fontFamily="AxtYoumna",embedAsCFF="true" ,unicodeRange="U+0000-U+1000")]
       public const AxtYoumna:Class;
       [Embed(source="fonts/AXTSIL__.TTF", fontFamily="AxtSImplifed",embedAsCFF="true",unicodeRange="U+0000-U+1000")]
       public const AxtSImplifed:Class;  
       public function fonts()
         Font.registerFont(AxtYoumna);
         Font.registerFont(AxtSImplifed);        
    It succeed published into a .swf file. I load this file use
    Font.enumerateFonts(false);
    It shows the font I have embed, it seems embed succeed:
    FontsName::: AxtYoumna ||||| FontsType::: embeddedCFF
    FontsName::: AxtSImplifed ||||| FontsType::: embeddedCFF
    Then I use AxtYoumna, AxtSImplifed for my textfield
       charFormat.fontFamily = ffont;
       charFormat.fontSize = fsize;
       charFormat.kerning = Kerning.ON;
       charFormat.fontWeight = fbold ? "bold" : "normal";
       //charFormat.fontWeight = "bold";
       charFormat.fontLookup = flash.text.engine.FontLookup.EMBEDDED_CFF;
       charFormat.renderingMode = flash.text.engine.RenderingMode.CFF;
       charFormat.cffHinting = flash.text.engine.CFFHinting.NONE;
    The Text still not render correctly. 
    My builder is FLex 3, flash player 10, and Flex SDK 4.0.0.10485
    But if I use the font Arial/Arabic Transparent/Traditional Arabric, it works.
    I use AXtYOumna/AXtadvertising/AXtSImplified Light /AXtGihaneLightItalic /AXtYouSra/AXTTraditionalLight , it not works.
    I can use these font in Photoshop CS4 middleeast version to show arabic succeefully.
    Please help me.!

    I suppose that "The Text still not render correctly.  " means in particular that you don't the proper shaping (positional forms).
    If that's the case, I think it is explained by the fact that AXtYOumna does not have the necessary OpenType layout tables. TLF/FTE need those table to select the proper positional shapes. Those tables are present in Arial/Arabic Transparent/Traditional Arabric.
    Eric.

  • Problem retriving data from TLF

    I 'm having problem retrieving the data i need to from TLF, please have a look at the post i made over at stackoverflow that explains the problem i am having: http://stackoverflow.com/questions/6198736/data-from-tlf-textline. Thanks!

    rawTextLength : int
    [read-only]        The length of the raw text in the text block that became the line,       including the U+FDEF characters representing graphic elements       and any trailing spaces, which are part of the line but not are displayed.
    Your code seems good. I did not tried to get the atom of textline ago, so I can only share the experience I had.
    1.textline.y give me the bottom of the textline not the top. So you need to differ textline.y from textLine.getAtomBounds(atomIndex).y;
    2.When you use TLF, code like "_source.interactionManager.getCommonCharacterFormat"is not recommended.
    You need to write the code as follows to skip the call of getter function when you will use _source.interactionManager many times. Because when you run "a.b", you call the "get b()" in class "a". "get b()" may be a large function and cost a lot.
    var editManager:SelectionManager  = _source.interactionManager as SelectionManager;
    editManager.getCommonCharacterFormat()

  • Problem getting TLF to work in Flex Builder 3

    Hi,
    I have recently installed new SDK 4 for Flex builder 3 which is suppposed to include the textlayout.swc classes.
    Can anyone tell me how i can  get new TextLayout to work.

    Hi,
    This link does not specifically deal with TLF but should be a good starting point: http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/
    Abhishek
    (Adobe Systems Inc.)

  • Major problem with textfields set to TLF

    Looks like the garbage collector is not removing movieclips that have textfields set to TLF. I'm using Flash Builder's profile inspector and TLF brings in a bunch of objects and prevents the clip from being removed by the garbage collector (including all the objects that TLF put in memory).
    How could Adobe release CS5 with such a crappy implementation of text? If there is no solution I will have to avoid using TLF text for all my projects. I strongly suggest everyone avoid TLF.

    The solution is to use dynamic TLF textfields. Create them using actionscript.
    What I did in my project was use classic textfields just for layout purposes and then remove them with actionscript and replace them with a TLF textfield. In the destroy function for your class make sure you remove the TLF from the stage and set it's variable to null.
    Everywhere else in project where I didn't need TLF i switched back to Classic text fields.
    I needed the TLF for emoticons in a chat application. TLF will throw some items in memory when it loads the swz file.
    If you don't need TLF avoid it.

  • Basic problem with using TLF

    I am just starting in using Flash CS5 without any experience of using flash before.  I'm using the tutorials on Lynda.com to show me how to work through things.
    However, when I am trying to type text using the TFL setting, I get nothing but a blue box.
    I open a blank file, select the Text tool.  It comes up with the cross-hair the a small capital T to the bottom right.  I click on the stage to make the text box from the dotted lines/marching ants, then as soon as I let go, it snaps to the top left corner as a blue box.  And every time I repeat this,each subsequent box snaps to the top left corner.  When I click the selection tool, and make a box around the corner, all the different blue boxes I made fro my text tool is shown, but I still can't type even a single letter!
    When I use the classic tool, the text and typing work fine.
    What am I doing wrong??

    Please post a screenshot of your Property Inspector panel when the text tool is selected so we can see your text settings. Thanks!

  • ProLoader and TLF TextFields do not work together!

    I'm using ProLoader to load a .swf that uses TLF.  The master .swf loads the target .swf and all code executes as expected with one minor glitch: the content of the loader is white/blank.  Has anyone else seen this!?
    ~~~~~~~~~~~~~~~~~~~~~~~~
    Here is the full bug report that I tried to send Adobe, but they cap reports at 2000 characters and provide no option for uploading a source .zip. (Seriously, Adobe?)  If you have time, and follow my instructions you will see how ProLoader won't even load a .swf with TLF on its stage.  (Yes, I realize this different from my problem, but I'd like to demonostrate how buggy and inconsistent ProLoader is.  The simple solution would be not to use TLF, and mostly likely, I will end up doing that.)
    ******BUG******
    ProLoader loads .swf with TLF, but ProLoader is blank.
    Steps to reproduce bug:
    1.  Download sample files (http://helpx.adobe.com/content/dam/kb/en/141/tn_14190/attachments/Load_External_SWF.zip) from the Tech Note, Load external SWF into another SWF (http://helpx.adobe.com/flash/kb/load-external-swf-swf.html).
    2.  Open ExternalSWF.fla and assign it a document class.
    Here is mine:
    package  {
              import flash.display.MovieClip;
               import flash.events.Event;
              public class ExternalSWF extends MovieClip {
                        public static var DATA_LOAD_COMPLETE:String = "ExternalSWF_DataLoadComplete";
                        private var data_:String;
                        public function ExternalSWF() {}
                        //This function will be called from the .swf that loaded me.
                        public function loadData(data:String):void
                                  data_ = data;
                                  dispatchEvent(new Event(DATA_LOAD_COMPLETE));
                        public function get data():String { return data_; }
    3.  On ExternalSWF.fla's stage, change a classic TextFields into a TLF TextField.
    4.  In Loader_Movie.fla, change all flash.display.Loader instances to fl.display.ProLoader in order to load TLF TextFields.  Also, add an event listener to myLoader for Event.COMPLETE.  Here are my Loader_Movie.fla's Actions:
    import flash.events.Event;
    import fl.display.ProLoader;
    var myLoader:ProLoader = new ProLoader();                     // create a new instance of the ProLoader class
    var url:URLRequest = new URLRequest("ExternalSWF.swf"); // in this case both SWFs are in the same folder
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, myLoaderIsLoaded);
    myLoader.load(url);                                     // load the SWF file
    addChild(myLoader);                                     // add that instance to the display list, adding it to the Stage at 0,0
    myLoader.x = 10;                                        // move the loaded SWF 10 pixels to the right (from the left edge)  
    myLoader.y = 175;                                       // move the loaded SWF 175 pixels down from the top
    // (optional) load a second external SWF file
    var my2ndLoader:ProLoader = new ProLoader();
    var url2:URLRequest = new URLRequest("ExternalSWF2.swf");
    my2ndLoader.load(url2);
    addChild(my2ndLoader);                                  // optionally, you could put the 2nd SWF beneath
                                                            // the 1st by using addChildAt(my2ndLoader, 1);
    // (optional) scaling of the 2nd SWF file
    my2ndLoader.scaleX = 2;                                 // scale the SWF horizontally by 200%
    my2ndLoader.scaleY = 2;                                 // scale the SWF vertically by 200%
    function myLoaderIsLoaded(event:Event):void
              trace("The first .swf has loaded so add event listeners");
              var swf:ExternalSWF = ExternalSWF(myLoader.content);
              swf.addEventListener(ExternalSWF.DATA_LOAD_COMPLETE, allFinished);
              swf.loadData("foobar");
    function allFinished(event:Event):void
              trace("Here is the data we loaded: " + ExternalSWF(myLoader.content).data);
    Results:
    [Trace] Output
    ReferenceError: Error #1056: Cannot create property __id0_ on ExternalSWF.
              at flash.display::Sprite/constructChildren()
              at flash.display::Sprite()
              at flash.display::MovieClip()
              at ExternalSWF()
    ExternalSWF is invisible; 4 loading dots appear instead.
    Expected results:
    Both .swfs load without incident.
    Trace output:
    The first .swf has loaded so add event listeners
    Here is the data we loaded: foobar
    Additional notes:
    I discovered this bug when my main/master .swf used ProLoader to load another .swf (with TLF on a symbol in the libary).  In this case, the ProLoader appeared blank/white, not even the 4 loading dots.  However, all the code in both .swfs still ran as expected (shown via the Output panel dumping all expected trace statements until execution finished).
    Environment:
    Adobe FLash Professional CS5.5, Version 11.5.1.349
    (bug discovered while running "Test Movie" in IDE)
    Windows 7 Professional Service Pack 1
    Intel(R) Core(TM)2 Duo CPU  E4600 @ 2.40GHz  2.39 GHz
    RAM: 6.00 GB
    64-bit Operating System

    Do you have anything that uses TLF in your preloader? It's possible that the TLF framework has made your preloader so heavy that it merely appears to not be doing anything, but the actual case is that all that stuff has to load before it can show you anything.
    You may find this helpful http://jeffkamerer.com/blog/2010/08/12/using-a-custom-preloader-loop-with-tlf-text/
    However, I don't really understand why you feel you have to use TLF to bring in the text from Photoshop. I think you must mean PhotoShop PSD's, because PhotoShop PNG's will not contain editable text (though Fireworks ones can). I get Photoshop comps all the time and bring the text in as Classic Text. While it's not an exact match 100% of the time, it's as close a match as you're going to get based on the limitations of Classic text. I think there's no reason for your designers to be redoing the designs--you just need to play around with the import settings and figure out what gets you close and then what tweaks you need to do to get closer.
    And, to answer your question, nearly everyone creates graphics for Flash files in Photoshop, despite Fireworks being the better tool. For whatever reason, designers often aren't very adventurous when it comes to learning new tools, and nearly all art schools teach PhotoShop.
    I also don't have any trouble loading CS5.5 AS3 swfs (no TLF--I just don't need the hassle) with Document Classes using an ordinary Loader. So I think there's something not right about what you're doing if you've come to the conclusion that you can't load a swf with a Document Class. Try scaling back to the bare minimum, then working up.
    Finally, I just don't "get" why people do two things that you're doing (or, I do, but I think it's unnecessary and a colossal failure on Adobe's part)
    Instantiating everything through code. Not only are you wasting an inordinate amount of time/code in specifying layout, you also completely lose the natural capability of Flash to compile assets throughout the whole of the swf. This means you have to have a preloader, because literally everything you ever use is embedded before the first visual frame. Contrast to using the timeline, where all you need to load the visuals for the first frame is the Document Class (which you can keep light by coding to Interfaces) and the visuals for the first frame. Anything else you need to load, you can defer to the frame that you've selected for embedding your AS Classes on.
    Using a preloader at all.
    My preloading strategy is very simple. I put a spinner graphic in the first frame, with the word "Loading." The playhead will stop at the frame that I've specified to use for exporting my ActionScript Classes (10--this provides enough space for the label "Loading" to be readable). When the embedded Classes and whatever is needed to display frame 11 is loaded, the playhead will continue to frame 11 by itself, with no code. On Frame 11, I have a MC that is a named instance, and I have a getter/setter pair to catch it. When the setter triggers, I know I'm ready to start the logic.
    However, you could do all sorts of things, like just putting a MC there that "is" the entirety of your other logic (has what is now the Document Class of the swf you're preloading as its BaseClass).
    Anyway, maybe something in my ramble will help you.

  • Problem with textboxes in Flash CS5

    Hi, I am currently a Flash CS4 user and am trying Flash CS5 currently to see if it is worth it to pay for the upgrade. I currently have a problem with the use of textboxes in CS5 comparing with the previous version. When I try to change the texts of a text box using the following command in actionscript:
    showlmytext.text = "My string: " +String(somevariable);
    I would get weird misaligned text outputted in my textbox, which exact same code did not cause this problem on Flash CS4.
    Can somebody please tell me what is the problem and how can I fix it?
    Thanks

    Hi Mario,
    I hope you are well. My name is Sandi Langlotz.
    At my job at greenidea.com, here in SF; I am having difficulty with using Hebrew in the trial download of CS5 Flash. Russ Mumford my boss has also contacted you regarding our problem.
    Flash has a new TLF (Text Layout Format tool).  My difficulty has to do with text boxes that are formatted for Right to Left text, with Hebrew selected as the Locale. We are pasting from Microsoft Word.
    I hope  that you may have a suggestion, a referral  or a possible work around for me to try.
    I have tried Adobe Customer Service several times to no avail.
    Problem 1.
    The first sentence below, (in blue) is correct format for Hebrew. Hebrew reads from R to Left.
    When I paste the Hebrew text into the Flash animation, one of two things can happen;
    the punctuation is cut off of the left side completely; or it is pasted in to the Right side of the Text box, (at the wrong end of the sentence). 
    I have tried to click the cursor into the left in order to insert the punctuation mark; this works sometimes but often I am unable to click in to manually correct the problem. I don't understand why it is cutting it off, or why I am sometimes unable to click into the left side and insert the punctuation.
    Problem 2
    In the second paste (the 2nd bold sentence),  .CSO on the left side of the sentence is correct, as is the rest of the sentence.
    When I paste the text  into Flash from Word, Flash puts it in as reversed order. the word CSO. has the punctuation switched to the right (CSO.)  Flash reverses the order of the other characters in the sentence also (like in the 2nd black sentence).
    שולחן נקי הוא שולחן מאובטח.
    שולחן נקי הוא שולחן מאובטח
    מבוסס על רעיון ממגזיןCSO .
    .CSOןיזגממ ןויער לע ססובמ
    Adobe says it supports Right to Left text, but I can find no info on these two buggy problems. Do you have any idea what is wrong?
    Thank you ahead of time for any info or referrals you may suggest.
    Sandi Langlotz
    שולחן נקי הוא שולחן מאובטח.
    שולחן נקי הוא שולחן מאובטח
    מבוסס על רעיון ממגזיןCSO .
    .CSOןיזגממ ןויער לע ססובמ

Maybe you are looking for

  • Can I use iCal/Mail from Snow Leopard to access iCloud?

    Hi All- I got the iOS 5 upgrade on my iPad & iPhone.  I have a MBP that is running Lion (10.7.2), and a MacPro that is still running Snow Leopard (10.6.8). I currently use MobileMe to sync my calendars, contacts, and bookmarks.  I can view these in i

  • I can't delete in Slideshow Mode

    In CS2 I could view have multiple image and I quickly go through them deleting undesired in Slideshow View. CS3 won't let me do that. When I hit delete it is still there. Then if I switch view it doesn't show the files and marks them as hidden. I am

  • Issue in xml to tab seperated content conversion

    Hi, I am having proxy to file scenario, in few columns data is coming like "AAA""B, in moni, xml data seems to be fine, but when the Excel file is genertaed at the FTP, the leading cell values are getting appended to this value. e.g. A     B     "ABC

  • How can I forward to a jsp under the WEB-INF directory?

    I have a webapp with a jsp that forwards to a jsp called /WEB-INF/pages/secure.jsp When I try to forward to it, I get the error: "trying to GET /mywebapp/WEB-INF/pages/secure.jsp, deny-existence reports: denying existence of /web/webapps/mywebapp/WEB

  • Class loading exception?

    Hi, I'm getting the following error message when I'm trying to cast an object. java.lang.ClassCastException: [Lorg.openadaptor.dataobjects.SimpleDataObject; cannot be cast to org.openadaptor.dataobjects.SimpleDataObject In my mind they are the same o