Skip navigation
Home/Support/

Forums

2897 Views 21 Replies Latest reply: Oct 13, 2010 3:19 AM by Dotanroi RSS
dotmix Calculating status... 9 posts since
Jul 6, 2009
Currently Being Moderated

Jul 6, 2009 10:46 AM

bloody hell RTL

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

  • rdermer Adobe Employee 695 posts since
    Jun 6, 2008
    Currently Being Moderated
    1. Jul 6, 2009 2:27 PM (in response to dotmix)
    Re: bloody hell RTL

    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

  • rdermer Adobe Employee 695 posts since
    Jun 6, 2008
    Currently Being Moderated
    3. Jul 8, 2009 12:02 AM (in response to dotmix)
    Re: bloody hell RTL

    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

  • Tim Hayes Calculating status... 5 posts since
    Dec 22, 2009
    Currently Being Moderated
    5. Mar 9, 2010 9:32 AM (in response to dotmix)
    Re: bloody hell RTL

    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

  • rdermer Adobe Employee 695 posts since
    Jun 6, 2008
    Currently Being Moderated
    6. Mar 9, 2010 10:42 AM (in response to Tim Hayes)
    Re: bloody hell RTL

    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

  • Tim Hayes User 5 posts since
    Dec 22, 2009
    Currently Being Moderated
    7. Mar 9, 2010 12:23 PM (in response to rdermer)
    Re: bloody hell RTL
    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

  • rdermer Adobe Employee 695 posts since
    Jun 6, 2008
    Currently Being Moderated
    8. Mar 9, 2010 12:42 PM (in response to Tim Hayes)
    Re: bloody hell RTL

    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

  • Tim Hayes User 5 posts since
    Dec 22, 2009
    Currently Being Moderated
    9. Mar 9, 2010 8:07 PM (in response to rdermer)
    Re: bloody hell RTL

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

  • Tim Hayes User 5 posts since
    Dec 22, 2009
    Currently Being Moderated
    12. Mar 16, 2010 1:53 PM (in response to dotmix)
    Re: bloody hell RTL
    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);
     
     
    
  • Roboblob Calculating status... 12 posts since
    May 28, 2010
    Currently Being Moderated
    14. May 28, 2010 7:02 AM (in response to rdermer)
    Re: bloody hell RTL

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

     

    Any other url?

     

    thanks,

    Roboblob

     

           
  • robin.briggs Adobe Employee 753 posts since
    Nov 24, 2008
    Currently Being Moderated
    15. May 28, 2010 6:36 PM (in response to Roboblob)
    Re: bloody hell RTL

    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

  • Alan Stearns Adobe Employee 246 posts since
    Nov 21, 2008
    Currently Being Moderated
    17. Jul 7, 2010 7:19 AM (in response to dotmix)
    Re: bloody hell RTL

    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.

  • Samahudeen Calculating status... 1 posts since
    Sep 30, 2010
    Currently Being Moderated
    19. Sep 30, 2010 9:33 PM (in response to dotmix)
    Re: bloody hell RTL

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

  • sazzad ahmmed User 27 posts since
    Aug 12, 2010
    Currently Being Moderated
    20. Oct 13, 2010 1:22 AM (in response to Samahudeen)
    Re: RTL

    Thanks all for this conversations...

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

     

    Cheers

    Sazzad Ahmmed Mohon

  • Dotanroi Calculating status... 1 posts since
    Oct 13, 2010
    Currently Being Moderated
    21. Oct 13, 2010 3:19 AM (in response to sazzad ahmmed)
    Re: RTL

    No problem, change it.

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

    good work!

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

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