This content has been marked as final. Show 19 replies
createTextField() does not return a reference to the textfield created. you're creating the textfield but your reference is incorrect in the 2nd example.
hmm...how would I create the text field inside a movieclip? Or is that not possible?
just like you're doing:
I tried that:
var tempText = thumbnail_mc.createTextField("tf"+k, thumbnail_mc.getNextHighestDepth(), 100*k, 100, 75, 100);
thumbnail_mc["tf"+k].text="this is your text";
When I hover over the text area in the movie, the cursor changes to the text cursor. But the text area is actually blank.
is k defined?
are you masking the movieclip that contains your textfield or doing something else that requires font embedding?
Yes, k is defined.
I have a loop at the top:
//other code goes here
If I trace k, i also get results.
If it helps, all of the code is specified in the action layer at the very topmost layer. There is a mask around the entire stage. Under the masked layer, there is the thumbnail_mc.
I found a post that had a similar problem I do:
I'm trying to figure out what I need to change since this is still nto working. But hopefully this will give me a good enough lead
are you masking your movieclip or tweening it?
I'm doing both - not sure what you mean entirely.
This is for a dynamic image scroller.
There's a mask layer on top of the movieclip. The movieclip loads a bunch of images that are tweened when you hover over them.
I think i'm getting closer. Maybe this will help someone see the problem:
var newMCText = thumbnail_mc.createEmptyMovieClip("tt"+k, thumbnail_mc.getNextHighestDepth());
trace(newMCText); //traces the correct level of the movie clip
newMCText.createTextField("tf"+k, thumbnail_mc.getNextHighestDepth(), 100*k, 100, 75, 100);
newMCText["tf"+k].text = eval("_root.imgURLName"+k);
That didn't quite work. But if I change the first line to:
var newMCText = this.createEmptyMovieClip("tt"+k, thumbnail_mc.getNextHighestDepth());
The text fields come up. The text fields are also inside of the newly created movieclip. However, I still need to get it one level deeper (in thumbnails_mc).
you must embed your font.
I had this:
var text_fmt:TextFormat = new TextFormat();
text_fmt.color = 0xFF0000;
text_fmt.font = "Georgia";
Or am I supposed to set it some other way for textfields created in this way? (The above didn't do anything.)
btw, thanks for helping out. This seems so close..
whoops. Forgot to mention...I've tried:
newMCText["tf"+k].embedFonts = true;
text_fmt.embedFonts = true;
text_fmt.font = "Arial";
. . .
Neither of those worked for the dynamically generated text fields.
you must have a font in your library with linkage id of "Arial". do you?
Ah. Wow. Thanks - I don't have that. I'll have to look into importing fonts into the library then. I thought it would use the font that is in Flash without needing to have it in the library.
Yep, that was it. I just added the font in the library and linked it. It works now. Thanks so much!
click on the upper right of your library panel, click on new font and select a font from the dropdown box and click ok. find the font in your library panel, right click it, click linkage, tick export for actionscript and give it a linkage id. use that linkage id when assigning a font property for your textformat.