- Веб-Шаблоны
- Шаблон интернет-магазина
- Шаблоны для CMS
- Facebook шаблоны
- Конструктор сайтов
XML Flash. Как включить поддержку RTL
Март 14, 2012
Эта инструкция продемострирует, как сконвертировать XML Flash шаблон для RTL отображения (ориентация текста справа налево).
1) Откройте FLA файл и перейдите раздел File >> Publish settings на вкладку Flash. Установите версию Flash плеера 10 или выше.
2) Во FLA файле в Flash CS5 или Flash CS 5.5 найдите шрифты в библиотеке, сделайте двойной клик и перейдите на вкладку actions.
вы увидите несколько флажков, как “export for ActionScript” и “export in frame 1?”. Выберите их оба и выберите в поле Outline Format вверху вкладки actionscript значение “TFL”.
Этот шаг необходимо сделать для всех шрифтов в шаблоне.
3) Откройте файл “main.as” и добавьте вверху страницы следущие функции:
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) Обычно у текстовых полей в файле AS назначена следующая функция:
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;
}
}
Вы должны вызывать функцию TFL в конце и придать ей вид:
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);
}
Это, как и следующая переменная, может отличаться в зависимости от текста, к которому вы применяете. В этом случае текстовая переменная: nameText, так что, если у нас “readmoreText”, то наша функция будет выглядеть следующим образом:
createTLF(readmoreText, readmoreText.htmlText);



