custom text format on a TextArea using flash actionscript

Posted by Vineela | Flash, as3, utils | Monday 29 December 2008 9:38 am

import fl.controls.TextArea;

var tF:TextFormat = new TextFormat();
tF.color = 0x0000FF;
tF.italic = true;
tF.bold = true;
tF.font = "Monotype Corsiva";
tF.size = 15;

var tI:TextArea = new TextArea();
tI.setStyle("textFormat", tF);
addChild(tI);
 

restricting which characters a TextInput can accept using flash actionscript

Posted by Vineela | Flash, as3, utils | Sunday 28 December 2008 9:33 am

import fl.controls.TextInput;

function textValid(  ) {
  var field:TextInput = new TextInput(  );
  field.restrict = 'a-z';
  addChild(field);
}

textValid();
 

check whether the content is successfully loaded or not with UILoader using flash actionscript

Posted by Vineela | Flash, as3, utils | Saturday 6 December 2008 10:51 am

import fl.controls.TextArea;
import fl.containers.UILoader;

var uiL:UILoader = new UILoader();
uiL.addEventListener(IOErrorEvent.IO_ERROR, uiLoader_ioError);
uiL.source = "SOMETHING.jpg";
addChild(uiL);

function uiLoader_ioError(evt:IOErrorEvent):void {
    var tF:TextFormat = new TextFormat();
    tF.color = 0x0000FF;
    tF.font = "Monotype Corsiva";
    tF.bold = true;
   tF.size = 14;

   var tA:TextArea = new TextArea();
   tA.setStyle("textFormat", tF);
   tA.text = evt.text;
   tA.width = 300;
   addChild(tA);
}
 

masked password in textArea with flash actionscript

Posted by Vineela | Flash, as3, utils | Friday 5 December 2008 5:05 am
import fl.controls.CheckBox;
import fl.controls.TextArea;

var cB:CheckBox = new CheckBox();
cB.label = "Display as Password";
cB.addEventListener(Event.CHANGE, cB_password);
cB.width = 200;
cB.move(10, 5);
addChild(cB);

var tA:TextArea = new TextArea();
tA.displayAsPassword = false;
tA.width = 125;
tA.move(15, 40);
addChild(tA);

function cB_password(evt:Event):void {
    tA.displayAsPassword = cB.selected;
}