Skip to main content
Known Participant
March 28, 2011
Question

Scroll Area resized not always revealing all when scrolling

  • March 28, 2011
  • 1 reply
  • 620 views

Sure this one's prbably me somehow it's hard to explain and reproduce I fear.

Basically I'm resizing a text area inside a scroler with dynamically loaded text from an XML file.

It's HTML with formating various font sizes and style stuff with/for hyper linking actions and stuff really awesome.

Lately I've been trying to resize for multiple devices and potentially try and maintain ledgibility in text in the text areas.

Okay well despite all that this still rings try for something buggy I'm pretty sure.

I use the scroll knob or my own click drag methods and it stops short of the end...

Then I roll my mouses scroller wheel and down it goes to the missing cut off remaining part of the srcoller which was clearly larger but the scroller didn't know about it yet scrolling the scroll wheel made it wake up to the fact that it wasn't at the bottom of the text area/content.

Maybe I'll look for a way to update the scroller with a invalidatation call of some sort, that it normally does to some degree anyway?

The way sometime I can't find the stage created yet in creationComplete likely relates to things not fully sorted before this is all happening apon creation of my spark View's in the MobileApplication navigation system.

This topic has been closed for replies.

1 reply

as4moreAuthor
Known Participant
March 28, 2011

Also I just noted this is with larger amounts of content, and I have to scroll the wheel to see what's hiding at the top after doing it to reveal the bottom... there is no scroll wheel on mobiles this is not good.

Here is some of the code I use that works fairly well...

        public function resizeTextArea(ta:TextArea):void {
            if(ta != null) {
                var mtf:MobileTextField = ta.textDisplay as MobileTextField;
                var tlm:TextLineMetrics = ta.measureHTMLText(mtf.htmlText);
                ta.height = (mtf.numLines * tlm.height);
            }
        }

Oh heck here's another little give away snippet...

                    var styles:String = timersXML.views.@styles;
                    if(styles != null) {
                        var contentSS:StyleSheet = new StyleSheet();
                        contentSS.parseCSS(styles);
                        mtf.styleSheet = contentSS;
                    }
but I don't think it really matters too much with the behaviour of the scroller versas it's content?

Oh mtf is done like this...

                mtf = targetTextArea.textDisplay as MobileTextField;

One should further note that I'm scaling content scaleX & scaleY via Vgroups and HGroups surrounding everything to manage the size changes between the different devices. So there's likely a mixup in there somewhere.

I imagine again refering to other posts that all this might not matter if apon initialization when calling the MobileApplications spark View creationComplete init function I could see the stage and set the scale there. Still it seems the content on text in a textarea needs to change size to maintain legibility.

So further reporducability details might include to say...

    <s:VGroup id="allGroup" left="8" right="8" top="8" height="614" gap="8" horizontalAlign="center">
        <s:Scroller id="contentScroller" left="0" right="0" top="0" width="480" height="612" skinClass="mycustomclasses.fixas3.VisibleScrollerSkin">
            <s:VGroup id="scrollGroup" gap="4" width="480" height="612" horizontalAlign="justify" paddingBottom="2" paddingLeft="2" paddingRight="24" paddingTop="2">
                <s:TextArea id="contentTextArea" left="2" right="2" top="2" bottom="2" fontFamily="Verdana" fontSize="18" text="Loading..." textAlign="justify" selectable="false"/>
            </s:VGroup>
        </s:Scroller>
    </s:VGroup>
The allGroup is scaled to adjust for the device size changes, and the contentTextArea will have a scale change to undo the parent container, while the height is calculated based on the dynamically loaded content.

But again probable not so much in the details as using the scroll wheel reviews content not scrollable to with the scrollbars or via dragging.

I let you know if and when I figure out any better what's holding deployment back here.

Oh I remember there is also a custom ScrollerSkin related to a previous thread I made for it always being visible, but again not related or important.

as4moreAuthor
Known Participant
March 30, 2011

I've noted that it's likely something to do with my code.

It seems that if the text area is smaller then the text inside it it will allow scrolling with that behaviour... via the scroll wheel.

I guess I should look for a setting that resizes the text area automatically for me, why I'm doing it and rather unsucessfully under complex scaling conditions (for multiple Mobile Devices ultiately), myself seems wrong too.

Any suggestions for what/where to find if that exists already, and will help in this situation?

It seems to me that Layout handling of Groups and their contents is simple not properly working. I refer one to IB (Interface Builder) as proper methodology. Avoid using NetBeans or and Java layout as an example of proper function here (my working experience with that was also below expectation).