0

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 change.

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");
            }
        }
    }

}
Lacrymology
  • 2,269
  • 2
  • 20
  • 28
  • I realized that I try to make these changes before the text gets loaded onto the component, in the parent's constructor. Is there a way I can get a function called after that is done? plus, I've also set editalbe=false in that constructor, and I still can edit the texts.. this is a problem.. – Lacrymology Apr 26 '11 at 16:18
  • Are you using the TextArea component's UIScrollBar or are you using a custom scroll bar utility? – Corey Apr 26 '11 at 17:02
  • I'm using the TextArea as it comes. I did reskin the scrollbar, but kept all the sizes, I'm quite sure. Besides some times the TextArea only shows like half the text with the scrollbar thumb on the bottom, and then when I do the select-the-text trick, it goes half way up the track again... – Lacrymology Apr 26 '11 at 17:19

2 Answers2

0

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.";
Corey
  • 5,818
  • 2
  • 24
  • 37
  • It sometimes works and sometimes doesn't, it fails with texts way longer than that, with html markup and a different typeface – Lacrymology Apr 26 '11 at 16:46
0

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.

Feltope
  • 1,098
  • 6
  • 9
  • yeah, but that would force it to go all the way down, and that might not be what I want. I'm conviced now that part of the problem is that I'm running this before the contents of the textArea are set – Lacrymology Apr 26 '11 at 18:35