PDA

View Full Version : [AS3] TextArea Formatting


Irianna
07-17-2008, 10:02 PM
Hello all,

I was wondering if anyone was able to help me.
I've got an action set to pull some information up on screen from a file.

I'd like to find away to get the text to be White, Arial, Bold, and size 15... but i have no idea how! i've been trying to figure it out for over a week now and no luck at all.

Is anyone able to help?

Below is my action.
This is using ActionScript 3 in Flash CS3

var externalReq:URLRequest = new URLRequest("SYM.txt");
var externalLoad:URLLoader = new URLLoader();

externalLoad.load(externalReq);
externalLoad.addEventListener(Event.COMPLETE, textReady);

function textReady(event:Event):void {
box1.text = event.target.data;
box1.setStyle("upSkin",Sprite);
}


I look forward to your replies.


Many Thanks, Irianna

bloodstyle
07-18-2008, 02:52 AM
You could create a TextFormat for it, like so:


var f:TextFormat = new TextFormat();
f.font = "Arial";
f.color = 0xFFFFFF;
f.bold = true;
f.size = 15;

box1.setTextFormat(f);
Or just defaultTextFormat if you want it on everything.

Irianna
07-18-2008, 06:56 AM
Hi
Many thanks for your repy, I must admit i'm hopeless at this new AS3

Unfortunatly i'm still stuck as thats not seemed to work for me.

What I'm trying to do is: http://www.alternate-galaxy.com/RedJelly/Index.htm
Click Shows button to see what i'm trying to do.

I just want it to show the information on it but it has no formatting to the text and is just boring looking.

if anyone could suggest a better way of doing it i'm really open to suggestions

many thanks, Irianna

gellm
07-18-2008, 08:41 AM
var CatTitle_tFormat:TextFormat = new TextFormat();
CatTitle_tFormat.font = "Arial";
CatTitle_tFormat.color = 0x800000;
CatTitle_tFormat.size = 16;
CatTitle_tFormat.underline = false;
CatTitle_tFormat.align = "left";

var newTextObj:TextField = new TextField();

newTextObj.defaultTextFormat = CatTitle_tFormat;
newTextObj.x = 50;
newTextObj.y = 80;
newTextObj.text = "Hello World";
newTextObj.selectable = false;
newTextObj.name = "mrText";
newTextObj.autoSize = TextFieldAutoSize.LEFT;