开发者

AS3 TextField is blank, doesn't accept any of my settings?

Having a strange issue with assigning a TextField to a movie clip.

            nameFormat = new TextFormat();
            nameFormat.size = 14;
            nameFormat.color = "0x000000";
            nameFormat.border = true;
            nameFormat.font = "Arial";
            charName = new TextField();
            charName.defaultTextFormat = nameFormat;
            charName.text = value.charname;
            charName.x = 92.5;
            charName.y = 6.5;
            charName.width = 205;
            charName.height = 21;
            thechars[value.charid].addChild(charName);

If I trace charName.text it traces correctly, but when the containing movieclip is displayed, it is always blank and none of my settings (borders, background color, etc..) show up. I'm placing several of these movieclips into another movieclip, which is then added to a scroller as such:

            scrollContent.addChild(thechars[newvalue.charid]);
            theScroller.source = scrollContent;

The strange thing is that I am using the exact same method to drop a button into each of the 'thechars' and it shows up and works fine. AND... if I hover my mouse over the spot where the textField should be, I can see my mouse change from a pointer to a text cursor, so the textFields are showing up, they are just blank?

Help?

UPDATE :

I tried something else and I'm even more confounded... I placed the following code right on a frame and the EXACT same thing happened... I can see the textField is there with my mouse, but it is blank and the properties have no effect on it. Am I just completely missing something here? Could I have overwritten this class or something? So confused...

            var descFormat2:TextFormat = new TextFormat(); 
            descFormat2.color = "0x000000"; 
            var charDesc2:TextField = new TextField(); 
            charDesc2.defaultTextFormat = descFormat2; 
            charDesc2.text = "THIS IS MY TEXT"; 
            charDesc2.x = 92.5; 
            charDesc2.y = 28.8; 
            charDesc2.border = true;
            t开发者_开发百科his.addChild(charDesc2);


As usual, it was something stupid. I had a mask over the entire area... which apparently doesn't work with AS3 textfields? Strange. I removed the mask over the area and they showed up. Not quite sure how that makes any sense but it solved the problem!!!


if you are trying to apply a mask to it, then you need to use the TextField.mask property to assign it after creation.

glad you sorted your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜