Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to set alpha to TextField?

Explorer ,
Nov 21, 2008 Nov 21, 2008
I've created a txtField with background set to true, backgroundColor set to a certain color, and txtField.alpha set to 10; however, the alpha does not work. The background color of txtField appears to have a full opaque color and not transparency. Any suggestion is appreciated.
TOPICS
ActionScript
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2008 Nov 21, 2008
That is because in AS3 the alpha property runs from zero to 1. Try an alpha of .1.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2008 Nov 21, 2008
I've had issues with textfields before and alpha - never using background colours but this may help....

I found that alpha only works with textfields if the textfield uses embedded fonts.

import a font to you library - export for actionscript call it myFont.

import myFont;

var myFontImport:String = new myFont().fontName;
var theFormat:TextFormat = new TextFormat();
theFormat.color = 0xFFFFFF;
theFormat.size = 14;
theFormat.font = myFontImport;

myTexField.embedFonts = true;
myTexField.text = "some text here";
myTextField.setTextFormat(theFormat);
myTextField.alpha = 0.1;


Remember the alpha is between 0 and 1 NOT 0 and 100

Greg
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2008 Dec 01, 2008
Thanks, GregConn. I have to use the TextFormat to set it.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2008 Dec 01, 2008
LATEST
you don't necessarily need a textformat instance to control the alpha of your textfield. you just need to use a reasonable alpha and embed your font.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines