Skip to main content
Participating Frequently
February 14, 2011
Question

Need help with Textarea. Trying to change font color. I'm using Actionscript 3.0.

  • February 14, 2011
  • 1 reply
  • 999 views

here is my code;

var requestObj: URLRequest = new URLRequest("jukebox.swf");
var loaderObj: Loader = new Loader();
addChild(loaderObj);
loaderObj.load(requestObj);

thumbnails_tl.addEventListener(Event.CHANGE, thumbnailClicked);

function thumbnailClicked(event:Event):void {
mineral_ta.text = event.target.selectedItem.data;
}

thumbnails_tl.addItem({label:"Akeboshi", source:
"thumbnails/Akeboshi.jpg",data:"Yellow Moon \n\nKinou wa Call Sign, \nZenbu, keitai de \nNore nai Fuzz Guitar \nHenna kouen de \n\nMuchuu de Motor Bike, \nKaze wo oikoshite \nMikaduki wa HISUTERII, \nBoku no ue de \nChikyuu wa GOORURAIN, \nInu mo raion mo \nKasei ni Moving On. \nNanka mendou de \n\nYellow Moon. ima mo, mittsu, \nKazoete, me wo akete \nShadow Moon \nMada yume wo miteru \n\nMe wo mite, me wo mite, \nSe wo muke ai nagara \nMe wo mite, Tell me yes or no? \n\nEveryDay EveryNight \nOmoi tsuku kotoba de \nKimi he no omoi wo ima sugu tsutaetai \nEveryDay EveryNight \nArifureta aizu de \nChirakatta mama no kimochi wo tsutaetai \n\nKibun wa kaisei, kondo, issho ni \nKarada wo dakishimete, kin no kyoukai de \n\nYellow Moon \nKaketa yozora dewa tsuki wa kyou mo \nShizuka na kao de hikaru no sa \n\nMe wo mite, me wo mite, \nSe wo muke ai nagara \nMe wo mite, Tell me yes or no? \n\nEveryDay EveryNight \nOmoi tsuku kotoba de \nEveryDay EveryNight \nKimi he no omoi wo tsutae you \nEveryDay \n\nYellow Moon. ima mo, mittsu, \nKazoete, me wo akete \nShadow Moon \nNada yume wo miteru \n\nMe wo mite, me wo mite, \nSe wo muke ai nagara \nMe wo mite, itsu aeru? \n\nEveryDay EveryNight  \nOmoi tsuku kotoba de \nKimi he no omoi wo ima sugu tsutaetai \nEveryDay EveryNight \nArifureta aizu de \nChirakatta mama no kimochi wo, ima sugu \n\nMahou no KOODOCHIENJI, \nNemure nai machi \nHigawari na JAZZ Guitar \nSotto MAINAA de."});

This is not all of it but i want to change it from black to like lets say green.

Is there a way to change it to a different color without using a xml or any other program?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
February 14, 2011

If you want to changer the color of the text in the TextArea component you can use a TextFormat for that.  If your TextArea is named ta...

var myTF:TextFormat = new TextFormat();
myTF.color = 0x00FF00;  // primary green

ta.setStyle("textFormat",myTF);

Participating Frequently
February 15, 2011

I need to know how and where in the actionscript i need to put it. Do i put the codes at the bottom of the script? The code you gave me what texts should i change and what should go there?

Thx,

ShadowFlash

Ned Murphy
Legend
February 15, 2011

You can put it anywhere you like in your code, just substitute whatever instance name you use for the "ta" I used.  As far as how to do it... I'd hope you know how to add code.