Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic text problem 1

Status
Not open for further replies.

Dustman

Programmer
May 7, 2001
320
US
Ok.. I've done this many times before but I seem to be missing somthing this time. I've got a movie clip that has 3 text boxes in it. I create several of these movie clips dynamicly (using attachMovie()) and populate the text boxes from my xml that i load in. All this works great. My problem is when I try to fade in or out each of these movie clips, my text disappears.

I know you have to embed the fonts but that doesn't work this time. No matter what, the text never shows up. I can take my script out for fading and the text is there. As soon as i do anything with the alpha of my movieclip, the text disappears. I can also just type text in and use a static field and it works great.

Layout is this..

_root.Container.PropertyRow0.txtLine1
_root.Container.PropertyRow0.txtLine2
_root.Container.PropertyRow0.txtLine3

_root.Container is just an empty movie clip created visually in flash. I use _root.Container.attachMovie('PropertyRow','PropertyRow'+i,_root.Container.getNextHighestDepth()) to attache each of my PropertyRows.

My script scrolls these clips around (and works fine just moving the PropertyRow#._x value.. but as soon as i adjust PropertyRow#._alpha my text fields disappear.

Am I missing something with the embedding? I though all i had to do in the past was just click on my text area, hit embed, and embed what I need (in this case its A-Z, a-z, punctuation and numeric).

I'm using Flash Pro 8 with AS2 classes.

Here is a link to what I'm getting right now.. the pics are scrolling (they are in the same mc as the 3 text boxes.. their common parent is what is fading.)


-Dustin
Rom 8:28
 
Dynamic TextField itself should have no issues with parent MovieClip's _alpha settings. To verify, create a blank FLA file, create a font symbol in the library (I called it "fontArial"), and place the following ActionScript:
Code:
// AS2 main timeline
this.createEmptyMovieClip("container", 1);
container.createEmptyMovieClip("propertyRow0", 1);
container.propertyRow0.createTextField("txtLine1", 1, 10, 10, 10, 10);
with (container.propertyRow0.txtLine1) {
	embedFonts = true;
	autoSize = true;
	html = true;
	htmlText = "<font face='fontArial'>Boo</font>";
	trace(htmlText);
}
container.propertyRow0.onEnterFrame = function():Void  {
	if (this._alpha>0) {
		--this._alpha;
	}
};
stop();
//
The text fades out as expected. So you probably have something else in your movie what's causing your problem.

Kenneth Kawamoto
 
I tried adding a font symbol to my library then creating the textfields dynamicly too.. I still had the same result. I'm trying to keep visual elements visually editable (I'm just a coder, I have another guy that is just a graphics guru).

I can change the textfields to "Use Device Fonts" and the text will show up (still no fading) but as soon as i change it to any anti-aliasing and embed the font, nothing works.

I've uploaded the source for you to look at yourself. Look for propertyRow in my library for the visual element.. and PropertyRow.as is the class file. attachProperty() is the function that changes the text in the dynamic clips. Notice right now i'm just setting txtLine1.text and it doesn't work.. the other 2 are commented out so their default text still shows and fades.


-Dustin
Rom 8:28
 
Yup that does it.. now why would that change when I set the text with actionscript? I figured the text box should stay the same? Is there a way to make it embed bold as well? I'm trying to make this dummy proof for my graphics guy..

-Dustin
Rom 8:28
 
You can create a font symbol with bold style selected and use htmlText specifying that font symbol as font face (as in my previous post), but if you want to let your graphics guy to control the text appearance that's not a solution for you.

Your graphics guy can always choose any font looks bold in its normal state (e.g. "Helvetica Black"): just he cannot choose bold style in the Flash IDE.

Kenneth Kawamoto
 
Ok.. that makes sense.. I've just never noticed that. Thanks for the help!

-Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top