开发者

fl.controls.TextArea not scrolling all the way down

开发者 https://www.devze.com 2023-02-28 16:05 出处:网络
I have a TextArea control, and sliding the scrollbar all the way down always doesn\'t show all the text.

I have a TextArea control, and sliding the scrollbar all the way down always doesn't show all the text.

I think it has something to do with me changing the typeface, because I noticed that when I do the setStyle to change the textFormat style, the textHeight value doesn't ch开发者_运维问答ange.

Has anyone ran into something like this? can I at least access the TextArea sources so I can fix this? Or is there a way to don't know, subclass it and fix it kinda easily?

you can check it here: http://www.climatizacionuponor.com/newsletters/abril-2011/#/FeriaBtn if you see the scrolling texts, you can try scrolling all the way down, and then selecting the text and pulling farther down, sometimes it'll show more text. Sorry about the spanish.

This is an example of a text that usually fails to scroll all the way down:

<p>Este accesorio es la evolución del antiguo sistema press fitting y resuelve los problemas que éste último presentaba. Mediante un anillo fabricado en acero al carbono que le proporciona un efecto memoria y gracias al indicador de unión, realiza el apriete por si solo sin necesidad de herramientas, garantizando unos ensamblajes profesionales, perfectos y duraderos. Los materiales de última tecnología que componen el nuevo accesorio RTM™ combinan el plástico más ligero con las mejores funciones mecánicas del metal, lo que garantiza una resistencia excepcional a temperaturas extremas. Además, dispone de un efecto de memoria que garantiza la estanqueidad en todo momento gracias a su presión constante de 360º sobre la tubería, que absorbe las variaciones de temperatura en la misma.</p><br><p>El Indicador de unión consta de un Código de Colores, lo que permite saber a simple vista el diámetro de tubería correspondiente, ahorrar tiempo y garantizar una unión más segura y fiable.</p><br><p>Mantener los niveles más altos de seguridad de las instalaciones es uno de los principales objetivos de Uponor, por eso se ha sometido a los productos a las pruebas más duras, llevando la Tecnología RTM™ a las más extremas condiciones de funcionamiento. En palabras de Sergio Toribio, Jefe de Producto de este sistema, “Ha sido un reto ser capaces de desarrollar un dispositivo que pueda funcionar bajo presiones altas, variaciones térmicas, e incluso a grandes movimientos de tracción en las extremidades de las tuberías que, si bien no son habituales en el día a día, suponen un riesgo para cualquier instalación.”</p><br><p>La Tecnología RTM™ resulta idónea tanto para nuevas instalaciones, como para reformas. Además, cumple con los más estrictos estándares de certificación internacional, como es de esperar de uno de los líderes en soluciones de fontanería y calefacción, tanto en Europa, como en América.</p>

and this is my code:

import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import fl.controls.TextArea;
import fl.controls.UIScrollBar;
import de.mightypirates.megazine.interfaces.IMegaZine;
import de.mightypirates.megazine.interfaces.IPluginManager;
import de.mightypirates.megazine.interfaces.IPage;
import de.mightypirates.megazine.plugins.anchors.IAnchors;

import flash.events.Event;
import flash.events.TextEvent;
import flash.text.TextField;
import fl.events.ComponentEvent;


public class Content extends MovieClip {

    var _mz:IMegaZine;

    public function Content() {
        var tf:TextFormat = new TextFormat();

        tf.font = "FoundryFormSans";
        tf.color = 0x2D2C2E;
        tf.align = TextFormatAlign.JUSTIFY;

        for(var i=0 ; i < numChildren ; i++)
        {
            var ta:TextArea = getChildAt(i) as TextArea;
            if(ta != null)
            {
                ta.setStyle("textFormat", tf);
                ta.editable = false;
                ta.textField.selectable = false;
                ta.verticalScrollBar.maxScrollPosition = ta.textHeight;
                ta.getStyle("textFormat");
            }
        }
    }

}


This is completely off the top of my head. I built a telnet client for flash once and sometimes it would not scroll all the way. So I forced it down.

TextField has a property called scrollH and you can set it to maxScrollH to force the TextField to the bottom.

myTextArea.textField.scrollH = myTextArea.textField.maxScrollH;

edit: Fixed the code line since TextArea was used.


I'm not sure what your code looks like, but this works fine for me:

var fmt:TextFormat = ta.textField.getTextFormat();
fmt.font = "Comic Sans MS";
fmt.size = 15;
ta.setStyle("textFormat", fmt);

ta.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam non sapien lorem. Etiam tincidunt consectetur neque, laoreet hendrerit magna commodo ac.";
0

精彩评论

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

关注公众号