<mx:Script>
<![CDATA[
//
import flash.events.*;
import mx.events.*;
import mx.controls.Alert;
import mx.controls.VScrollBar;
//
//Uncomment line below if you compile with Flex 2
//import mx.core.UITextField;
//Comment line below if you compile with Flex 2
import mx.core.IUITextField;
import mx.core.mx_internal;
use namespace mx_internal;
//
//Uncomment line below if you compile with Flex 2
//private var uit:UITextField;
//Comment line below if you compile with Flex 2
private var uit:IUITextField;
//
private var tF:TextFormat;
private var vsb:VScrollBar;
[Bindable]
private var otps:String;
[Bindable]
private var fnts: Array = [
{label:"Traditional Arabic", data:{family:"TraditionalArabic", weight:"normal"}}
, {label:"Andalus", data:{family:"Andalus", weight:"normal"}}
, {label:"Tahoma", data:{family:"Tahoma", weight:"normal"}}
];
private function doConvert(event:Event):void
{
convert();
}
private function onUpdate(event:Event):void
{
//Get the internal VScrollBar
var i:int = 0;
//Loop through the TextArea component to find the scrollbar instance
while(i<output.numChildren)
{
if(output.getChildAt(i).name.indexOf("Scroll") != -1)
{
vsb = output.getChildAt(i) as VScrollBar;
//Move internal VScrollBar to the left
vsb.x = 0;
break;
}
i++;
}
//Move internal textField to the right of VScrollBar
uit = output.getTextField();
uit.x = vsb.width;
uit.selectable = false;
}
private function convert():void
{
var selectedFont:Object = ft.selectedItem.data;
//Change the TextArea style to the selected font
output.setStyle("fontFamily", selectedFont.family);
output.setStyle("fontWeight", selectedFont.weight);
//Set the TextFormat properties
tF = new TextFormat();
tF.font = selectedFont.family;
tF.bold = (selectedFont.weight == "bold")? true : false;
//Set right and left margins to allow some space around text
tF.rightMargin = 15;
tF.leftMargin = 2;
tF.size = sz.value;
//
//Get the internal textField's width minus margins right and left
var wd:Number = uit.width - 17;
//Change the extraCharWidth property as needed
fb.extraCharWidth = xw.value;
//
var str:String = input.text;
//If you like remove Tashkeel from string
//str = fb.removeTashkeel(str);
//Convert the string
otps = fb.convertArabicString(str, wd, tF);
}
import flash.text.*;
import mx.controls.Alert;
import mx.collections.*;
//
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private namespace rss = "http://purl.org/rss/1.0/";
use namespace rss;
//
import mx.controls.VScrollBar;
//Uncomment line below if you compile with Flex 2
//import mx.core.UITextField;
//Comment line below if you compile with Flex 2
import mx.core.IUITextField;
import mx.core.mx_internal;
use namespace mx_internal;
//
private var tF:TextFormat;
private var vsb:VScrollBar;
//Uncomment line below if you compile with Flex 2
//private var uit:UITextField;
//Comment line below if you compile with Flex 2
private var uit:IUITextField;
[Bindable]
private var listArr:ArrayCollection;
[Bindable]
private var otps:String;
private function init():void
{
//Make the scrollbar hidden at start and move it to the left
vsb = getVScrollBar();
vsb.x = 0;
vsb.visible = false;
}
private function getVScrollBar():VScrollBar
{
//Get the internal VScrollBar
var i:int = 0;
//Loop through the TextArea component to find the scrollbar instance
while(i<lst.numChildren)
{
//Alert.show(String(lst.getChildAt(i).name), 'Error', Alert.OK);
if(lst.getChildAt(i).name.indexOf("Scroll") != -1)
{
vsb = lst.getChildAt(i) as VScrollBar;
return vsb;
}
i++;
}
return new VScrollBar();
}
public function updateLayout():void
{
//Make sure the scrollbar and the list items' positions are
updated on each list update
vsb = getVScrollBar();
vsb.x = 0;
//
var i:int = 0;
while(i<lst.numChildren)
{
//Alert.show(String(lst.getChildAt(i).name), 'Error', Alert.OK);
if(lst.getChildAt(i).name.indexOf("mask") != -1)
{
lst.getChildAt(i).x = 17;
private function onSuccess(event:ResultEvent):void
{
//
var feed:XML = event.result as XML;
listArr = new ArrayCollection();
// Put the result xml data into an ArrayCollection to work
as a dataProvider for the list
for each (var item:XML in feed.channel.item)
{
var obj:Object = {title:item.title
, description:item.description
, link:item.link
, pubdate:item.pubDate};
listArr.addItem(obj);
}
//
}
private function onFailure(event:FaultEvent):void
{
Alert.show(event.fault.message, 'Error', Alert.OK);
}
private function convert(str:String):void
{
//Get internal TextArea's textField
uit = output.getTextField();
uit.selectable = false;
// Make sure the scrollbar is visible
vsb.visible = true;
//Set the TextFormat properties
tF = new TextFormat();
tF.font = "TraditionalArabic";
tF.bold = true;
tF.size = 16;
tF.align = "right";
//Convert the string
// It's a good idea to minimize the internal textField's width by 2 pixels
in multiline text, just to be safe
otps = fb.convertArabicString(str, uit.width-2, tF);
}
import flash.text.TextFormat;
//
//Uncomment line below if you compile with Flex 2
//import mx.core.UITextField;
//Comment line below if you compile with Flex 2
import mx.core.IUITextField;
import mx.core.mx_internal;
use namespace mx_internal;
//
//Uncomment line below if you compile with Flex 2
//private var uit:UITextField;
//Comment line below if you compile with Flex 2
private var uit:IUITextField;
//
private var tF:TextFormat;
private var ss:String;
private function convert(str:String):String
{
//Get internal Text's textField
uit = itemLabel.getTextField();
//Set the TextFormat properties
tF = new TextFormat();
tF.font = "TraditionalArabic";
tF.bold = true;
tF.size = 16;
//Convert the string
ss = fb2.convertArabicString(str, uit.width, tF);
//
return ss;
}