开发者

as3 text-wrap problems, firefox, mac

开发者 https://www.devze.com 2023-04-10 14:19 出处:网络
So, I\'ve built a little site for a client that doesn\'t seem to have any problems for me. I post it, and my client reports to me that some of the text is being clipped off in the text fields. I try t

So, I've built a little site for a client that doesn't seem to have any problems for me. I post it, and my client reports to me that some of the text is being clipped off in the text fields. I try to recreate the problem on my pc with chrome and firefox, but everything works fine. But he sends me screenshots from his mac with firefox, and sure enough they are being clipped. He claims its only fire-fox, and it is not a factor of window size. so here are the images 开发者_运维技巧to show whats going on:

as3 text-wrap problems, firefox, mac

Further most right words should be "Alabama" & "growing"

and here is the code that produces that text (descTextNew is the culprit here):

        nameText.text = names[elementNumber];
        nameText.autoSize = "center";
        nameText.x = object.x + (.5 * videoWidth) - (.5 * nameText.width);
        nameText.y = object.y + videoHeight + 8;
        nameText.background = true;
        nameText.backgroundColor = 0x000000;
        textStyling.color = 0xFFFFFF;
        textStyling.size = 20;
        textStyling.font = myFont.fontName;
        textStyling.letterSpacing = 3;
        textStyling.align = "center";
        nameText.embedFonts = true;
        nameText.setTextFormat(textStyling);
        container.addChild(nameText);

        descTextNew.text = descArrayContent[elementNumber];
        descTextNew.y = object.y + videoHeight + nameText.textHeight + margin - 15;
        descTextNew.width = nameText.textWidth + 30;
        descTextNew.x = object.x + ( (videoWidth - descTextNew.width) / 2 );
        descTextNew.wordWrap = true;
        descTextNew.autoSize = "left";
        descTextNew.background = true;
        descTextNew.backgroundColor = 0x000000;
        descTextStyling.color = 0xFFFFFF;
        descTextStyling.size = Math.round(11 * 1000/stage.stageWidth);
        descTextStyling.font = myFont.fontName;
        descTextStyling.letterSpacing = .5;
        descTextStyling.align = "left";
        descTextNew.setTextFormat(descTextStyling);
        container.addChild(descTextNew);

Some of these variables are declared as instance variables prior like this:

    var names:Array = new Array();
    var nameText:TextField = new TextField();
    var textStyling:TextFormat = new TextFormat();
    var descTextNew:TextField = new TextField();
    var descTextStyling:TextFormat = new TextFormat();
    var margin:int = 28;
    var videoWidth:int = 267;
    var videoHeight:int = 150;

arrays names and descArrayContent have the strings "Paul Rollins, Sr." and "Paul Rollins runs a funeral... " added to them at an index number determined by the variable elementNumber. Also object is the image you see in the pic. don't think its necessary to show you that code.

Here's a link if you want to see it in action:

www.footsoldiers.org/test2/

Any ideas what the hell is going on? I don't know where to start.


Have you tried invalidating the control for redraw manually?

this.invalidateDisplayList();
this.invalidateLayering();
this.invalidateLayoutDirection();
this.invalidateProperties();
this.invalidateSize();


I would try to set the .text property after you have set all the other properties. So try putting the descTextNew.text = descArrayContent[elementNumber] action on the last line.

If this still doesn't fix your problem, I would recommend to also include the descTextNew.multiline = true property.

Good luck!

0

精彩评论

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

关注公众号