[contact-form-7 id="24078" title="Feedback EN"]

XML Flash. How to enable RTL support

This tutorial shows how to convert XML Flash template to RTL.

1) Open your FLA file and go to File >> Publish settings and select Flash tab, then set Flash player to version 10 or higher

2) In the FLA file in Flash CS5 or Flash CS 5.5 and locate your fonts in the library, doubleclick it and select actions tab

you will be able to see several check boxes like “export for ActionScript” and “export in frame 1? – you need to check both and select “TFL” in Outline Format at the top of the actionscript tab.

It is very important to do this step for all the fonts in the template.

3) Open you “main.as” file and add the following function at the top:

private function createTLF(_textField:TextField, _content:String):void
  {
  var TLF_Text:TLFTextField = new TLFTextField();
  var newTextFormat:TextFormat = new TextFormat ;
  newTextFormat = _textField.getTextFormat();
  TLF_Text.antiAliasType = _textField.antiAliasType;
  TLF_Text.embedFonts = _textField.embedFonts;
  TLF_Text.width = _textField.width;
  TLF_Text.x = _textField.x;
  TLF_Text.y = _textField.y;
  TLF_Text.rotation = _textField.rotation;
  if (_textField.multiline)
  {
  TLF_Text.height = _textField.textHeight + newTextFormat.size + newTextFormat.leading;
  }
  TLF_Text.setTextFormat(newTextFormat);
  TLF_Text.htmlText = _content;
  MovieClip(_textField.parent).addChild(TLF_Text);
  MovieClip(_textField.parent).removeChild(_textField);
}

3) Regularly text fields have such function in AS file:

public function textContent(nameText:TextField, numText:Number)
  {
  nameText.htmlText = websiteXML.pages.titlePage[linkPage].texts.pageText[numText].text();
  nameText.addEventListener( TextEvent.LINK, textLinkClick );
  nameText.mouseWheelEnabled = false;
  nameText.condenseWhite = true;
  if (nameText.multiline)
  {
  var fmt:TextFormat = nameText.getTextFormat();
  nameText.height = nameText.textHeight + fmt.size + fmt.leading;
  }
  else
  {
  nameText.autoSize = TextFieldAutoSize.LEFT;
  }
}

You should call TFL function at the end and make it look like:

public function textContent(nameText:TextField, numText:Number)
  {
  nameText.htmlText = websiteXML.pages.titlePage[linkPage].texts.pageText[numText].text();
  nameText.addEventListener( TextEvent.LINK, textLinkClick );
  nameText.mouseWheelEnabled = false;
  nameText.condenseWhite = true;
  if (nameText.multiline)
  {
  var fmt:TextFormat = nameText.getTextFormat();
  nameText.height = nameText.textHeight + fmt.size + fmt.leading;
  }
  else
  {
  nameText.autoSize = TextFieldAutoSize.LEFT;
  }
createTLF(nameText, nameText.htmlText);
}

This like has the following varibale that may differ depending on the text you implement it, as you can see our currect text variable is: nameText, so if we have “readmoreText”, then our function would look like:

  createTLF(readmoreText, readmoreText.htmlText);