createEmptyMovieClip + alpha?

Hey people!
I’ve searched quite some forums and browsed a lot of pages but I can’t figure out what I’m doing wrong here.

I want to create a new MC with a textfield inside. Once created I want the text to fade out with the use of MC._alpha–;

The problem is that I can’t figure out how to set the alpha of either the MC or the textfield inside of it.

The textfield uses an embedded font as some pages recommended, but it doesn’t matter if I embed it or not, it just doesn’t work.

This is the script I wrote:

_root.createEmptyMovieClip("clip",1);
_root.clip.createTextField("sText",2,20,20,150,30);
 
newFont = new TextFormat();
newFont.embedFonts = true;
newFont.font = "Font 1";
newFont.textColor = 0xFFFFFF;
 
_root.clip.sText.setTextFormat(newFont)
_root.clip.sText.text="test";
_root.clip.sText._alpha = 50;
_root.clip._alpha=50;

ANY help would be very much appreciated!!
Thanks in advance!

for 1, embedFonts is a property of a textField, not a textFormat. So that would need to go on _root.clip.sText. Same applies to textColor, though textFormats do have their own color property, its just color though, not textColor:

newFont.color = 0xFFFFFF

Also, when using a font, you should name it by its actual font name, and not by its symbol name which I assume you’re doing with “Font 1” ? And if you don’t have a symbol, make one, a font symbol that represents the font you want to use. Furthermore, since you’re using actionscript to define this text, you would want to change the linkage properties of the font symbol so that it is exported for actionscript and within the first frame. This way, Flash will know enough to use it with your dynamically created textfield.

Put that all together and your text should fade fine.

Thanks, Senocular, but it still doesn’t work.

I did exactly what you described. Everything works except for the alpha. I think it has something to do with the fact that the textfield is a dynamic field when using the createTextField() command. Cause the fact is that it does work on static textfields. So is there maybe a possibility to convert the dynamic textfield to a static textfield through actionscript?

My script is as follows:

_root.createEmptyMovieClip("clip",1);
_root.clip.createTextField("sText",2,20,20,150,30);
_root.clip.sText.text = "yooo";
_root.clip.sText.textColor = 0x000000;
_root.clip.embedFonts = true;
 
newFont = new TextFormat();
newFont.font = "verdana";
_root.clip.sText.setTextFormat(newFont);
 
_root.clip.sText._alpha = 50;
_root.clip._alpha = 50;

ok now you’re using embed fonts on the movieclip

THE TEXTFIELD I SAY, THE TEXTFIELD!

:slight_smile:

Sorry, that went wrong with pasting and retyped it wrong :s
Anyway, with _root.clip.sText.embedFonts = true; it won’t work either :wink:

are you sure you exported the font in the library?

you could break apart (ctrl+B) that text, than convert it into a symbol. for the first keyframe setProperty,alpha,100. in the last keyrame you set it at 50 (motion Twain).

you cant break it apart because its being created dynamically - thats kind of the point of the question :wink: