Skip navigation
dotmix
Currently Being Moderated

bloody hell RTL

Jul 6, 2009 10:46 AM

Hi

 

Im evaluating the flash cs4 IDE for my company for its new text layout RTL feature.

Ive been tring to implement a simple RTL text component with no success.

The only reason i am tring flash CS4 is for its RTL feature.

 

Please can someone give me a simple one liner example for implementing RTL in a TextLayout component (using actionscript 3 with flash CS4 - no flex!).

 

 

Thnx

Dotan

  • Currently Being Moderated
    Adobe Employee
    Jul 6, 2009 2:27 PM

    At this point I'd recommend not using the flash cs4 component that was posted last November.  Better would be to get the weekly build from labs and then directly add textLayout.swc to your project as a library.  All of the examples in the actionscript directory (included with the build) can be built with Flash CS4 and do not use Flex.

     

    I'd recommend the ImportMarkup.as example.  Modify the markup to include RTL content and add an EditManager.  Add direction="rtl" to the TextFlow element.  Sorry its not one line.

     

    There are known problems in FlashPlayer 10 with the IMEs and various languages.  Check the release notes for details.  Player team is working on adding IME support in the player.

     

    Hope that helps,

    Richard

    |
    Mark as:
  • Currently Being Moderated
    Adobe Employee
    Jul 8, 2009 12:02 AM

    Note this all applies to more recent builds than the original Flash CS4 extension.

     

    There is a TextFlow.getElementByID function.

     

    Docs are available here:

    http://livedocs.adobe.com/flex/gumbo/langref/

     

    I couldn't find a doc with the complete list of tags though it must be posted somewhere.  This should be useful to other folks as long as they get past the subject of the post.

     

    Here's a list and the class they map to.

    TextFlowTextFlow
    divDivElement
    pParagraphElement
    tcyTCYElement
    aLinkElement
    imgInlineGraphicElement
    brBreakElement
    tabTabElement
    spanSpanElement
    formatTextLayoutFormat
    linkNormalFormatTextLayoutFormat
    linkHoverFormatTextLayoutFormat
    linkActiveFormatTextLayoutFormat

     

    For the suported attributes check out the TextLayoutFormat class.  Also id and styleName are supported.

     

    Note that format elements may only be a child of a TextFlow and need to have an id property.   To refer to a named format use format="idname" on a element.  The link*Format tags are for specifying how LinkElements appear in different states.  They cascade to children when specified on parent elements.

     

    Richard

    |
    Mark as:
  • Currently Being Moderated
    Mar 9, 2010 9:32 AM

    I'm sure there are a million ways to do this better - I don't claim to be an AS3 expert. But I am also evaluating this for use with RTL languages and I got Arabic to work w/Flash CS4 in AS3. I pulled this chunk of code out of my implementation that seems to work:

     

    package com.foo{
      import flash.display.MovieClip;
      import flashx.textLayout.container.ContainerController;
      import flashx.textLayout.elements.*;
      import flashx.textLayout.formats.*;
     public class Main extends MovieClip{
       
      public function Main(){
        var textFlow:TextFlow = new TextFlow();
        textFlow.textAlign = TextAlign.RIGHT;
       
       var containerController:ContainerController = new ContainerController(this,400,400);
       containerController.verticalAlign = flashx.textLayout.formats.VerticalAlign.MIDDLE;
       textFlow.flowComposer.addController(containerController);
       
       var paragraphElement:ParagraphElement= new ParagraphElement();  
       paragraphElement.direction = flashx.textLayout.formats.Direction.RTL;
       paragraphElement.fontSize = 36;
       
       var spanElementTarget:SpanElement = new SpanElement();
       spanElementTarget.text = "السّلام عليكم.";
          
       paragraphElement.addChild(spanElementTarget);
       textFlow.addChild(paragraphElement)
       textFlow.flowComposer.updateAllControllers();
      }
     }
     
    }
    

     

    Note the period in the Arabic phrase appears correctly on the left in my rendered swf even though it appears here on the right.

     

    I'm using the textLayout.swc from the Flex SDK 4.0.0.10485. My swc is dated 9/22/2009. This may not work if you have an older one.

     

    -Tim

    |
    Mark as:
  • Currently Being Moderated
    Adobe Employee
    Mar 9, 2010 10:42 AM

    Also recomend to set textFlow.language="ar".

     

    Your swc is fairly old - recommend getting a newer one.  The latest builds are stable and near to shipping code.

     

    Richard

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 9, 2010 12:23 PM
    Also recomend to set textFlow.language="ar".

    Thanks Richard... good point.

    Your swc is fairly old - recommend getting a newer one.  The latest builds are stable and near to shipping code.

    Can I ask a stupid question? Where can I get the latest build? The Text Layout Framework section of the Adobe Open Source site says this is bundled with the Flex SDK and I  think I have the lastest copy of that. The Adobe Labs version looks like it is from 2008. Clearly I am missing something.

     

    -Tim

    |
    Mark as:
  • Currently Being Moderated
    Adobe Employee
    Mar 9, 2010 12:42 PM

    Latest swcs are available from this page.

     

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

     

    Not as easy to find as it should be.

     

    Richard

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 9, 2010 8:07 PM

    Perfect - thanks. That is exactly what I was looking for.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 16, 2010 1:53 PM
    Is there a way to access the text inside a TextLayout component with AS3?


    Sure. I'm not sure if this helps, but you could access the text inside the simple example I posted above with something like this:

    var leaf:SpanElement = SpanElement(textFlow.getFirstLeaf());
    trace(leaf.text);
     
    while(leaf = SpanElement(leaf.getNextLeaf()))
         trace(leaf.text);
     
     
    
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    May 28, 2010 7:02 AM

    The download you suggested http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

     

    Any other url?

     

    thanks,

    Roboblob

     

           
    |
    Mark as:
  • Currently Being Moderated
    Adobe Employee
    May 28, 2010 6:36 PM

    That's where you can get Flex 4.0. Note that 4.1 is now available, which comes with TLF 1.1. That's the latest.

     

    Is that what you're looking for?

     

    - robin

    |
    Mark as:
  • Currently Being Moderated
    Adobe Employee
    Jul 7, 2010 7:19 AM

    It's initially hidden. I'm not entirely familiar with the Flash CS5 UI, so it took me a little while to find it.

     

    1. Drag out a rectangle with the text tool.

    2. In the Properties panel, choose TLF Text

    3. In the top right menu of the Properties panel, choose Show Right-to-Left Options

    4. Now in the Paragraph section you'll have a Direction control which you can set to Right to Left.

    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2010 9:33 PM

    So, would u mind to change the title "bloody hell RTL"

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Oct 13, 2010 1:22 AM

    Thanks all for this conversations...

    I agree to remove the "Blooddy Hell" from the subject.

     

    Cheers

    Sazzad Ahmmed Mohon

    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2010 3:19 AM

    No problem, change it.

    the Flash CS5 TLF text field has full RTL support built in.

    good work!

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points