Scroll to TextLine

Hello

I have this list of quoted that in my position as an application for the start of a new page, I put in a little combobox so that the user can jump between pages in my application by selecting an element. (The entire TextFlow is in a container). By selecting an item, the paragraph specified, then scrolls to the top of the container.

I thought that this mechanism has been fairly easy to implement, like this:

var startPos:int = paragraphElement.getAbsoluteStart ();

var tfl:TextFlowLine = textFlow.flowComposer.findLineAtPosition (position);
containerController.verticalScrollPosition = tfl.y;

Now it works like a charm for the first two paragraphs, but subsequently the textflowline has property y of 0.

I understand now that it is, of course, because these lines have not been drawn yet.

So, of course I use the technique wrong to do this, so my question:

Is there a different way to an arbitrary point in your textflow to the top of your container to scroll?

Any help will be greatly appreciated, thanks in advance!

see you soon,

Roland

Use composeToPosition instead of scrollToPosition and then use your logic to achieve the TextLine.  There are other getScrollDelta on ContainerController API that can be useful.

Richard

Tags: Adobe Open Source

Similar Questions

  • Scroll to the location of a RichEditableText control

    I use a RichEditableText control to display a load of formatted text. It is divided into sections, with links to the sections at the top of the text.

    What I want, it's for each of these links to scroll the content until the paragraph identified the top of the viewport.

    That's what I tried:

    protected function application1_initializeHandler(event:FlexEvent):void

    {

    var flow: TextFlow = TextConverter.importToFlow ("< TextFlow xmlns ="http://ns.adobe.com/textLayout/2008' > < p styleName = "link" > < a href = "event: goto_section1" > Section 1 < /a > < /p > < p styleName = "link" > < a href = "event: goto_section2" > Section 2 < /a > < /p > < id p = "section1" styleName = "head" > Section 1 < /p > < p > Lorem ipsum dolor sit amet "") 195kgs adipiscing elit. Praesent and SEM ultrices. Nullam sit amet felis sem, luctus ornare mauris. Proin tincidunt porta ante, placerat odio restore dignissim lobortis. Aliquam erat volutpat. Pellentesque living morbi tristique senectus and netus and renowned malesuada ac turpis egestas. Duis vel dui sapien, non imperdiet lorem. Donec leo lacus viverra nec porttitor non, ullamcorper vehicula nunc. < /p > < p > Pellentesque molestie lorem lobortis nec city. Mauris ultricies congue lacinia, ante ipsum, nec semper ligula fermentum diam diam is quis total. Etiam dictum nisi pretium sit amet nunc fermentum lectus vitae mollis. Cum sociis natoque penatibus and magnis say parturient montes, nascetur ridiculus MUS Suspendisse potentialit. Nulla so, massa id MPCs, eros rutrum turpis augue lobortis had ullamcorper lacus sapien pulvinar felis. In ligula eleifend Mauris. Nullam aliquet, justo ut malesuada lectus quam sodales enim aliquet risus neque sit amet diam ut libero. < /p > < id p = "section 2" styleName = "head" > Section 2 < /p > < p > Lorem ipsum dolor sit amet, adipiscing elit computer. Praesent and SEM ultrices. Nullam sit amet felis sem, luctus ornare mauris. Proin tincidunt porta ante, placerat odio restore dignissim lobortis. Aliquam erat volutpat. Pellentesque living morbi tristique senectus and netus and renowned malesuada ac turpis egestas. Duis vel dui sapien, non imperdiet lorem. Donec leo lacus viverra nec porttitor non, ullamcorper vehicula nunc. < /p > < p > Pellentesque molestie lorem lobortis nec city. Mauris ultricies congue lacinia, ante ipsum, nec semper ligula fermentum diam diam is quis total. Etiam dictum nisi pretium sit amet nunc fermentum lectus vitae mollis. Cum sociis natoque penatibus and magnis say parturient montes, nascetur ridiculus MUS Suspendisse potentialit. Nulla so, massa id MPCs, eros rutrum turpis augue lobortis had ullamcorper lacus sapien pulvinar felis. In ligula eleifend Mauris. Nullam aliquet, justo ut malesuada lectus quam sodales enim aliquet risus neque sit amet diam ut libero. ("< /p > < / TextFlow > ', TextConverter.TEXT_LAYOUT_FORMAT);

    Flow.format = null;

    flow.addEventListener (FlowElementMouseEvent.CLICK, clickHandler);

    richText.textFlow = flow;

    }

    protected function clickHandler(event:FlowElementMouseEvent):void

    {

    if (event.flowElement is LinkElement)

    {

    link: = event.flowElement var LinkElement as LinkElement;

    if (link.href.substr (0,11) == "event: goto_")

    {

    var scrollToElement:FlowElement = richText.textFlow.getElementByID (link.href.substr (11));

    if (scrollToElement! = null)

    {

    var scrollToStart:int = scrollToElement.getAbsoluteStart ();

    richText.scrollToRange (scrollToStart, scrollToStart);

    }

    }

    }

    }

    " < s:Scroller id ="scroller"width =" 400"height =" 200">

    " .. s:RichEditableText id ="richText"" "

    "textAlign ="justify"

    "Width ="100%"

    "Editable ="false" / > "

    < / s:Scroller >

    Now, the problem is that it scrolls so that the header is at the bottom of the page, while I want it at the top (where the length of the text allows this). Only, I can't understand how to do this. Any ideas? Thank you.

    OK, I've sorted it. Finally.

    Propert textLines wasn't a help, since he held only the visible rows, not all that was outside the bounds of the viewport.

    It was my solution (not vigorously tested):

    If (event.flowElement is LinkElement)

    {

    link: = event.flowElement var LinkElement as LinkElement;

    If (Link.href.substr (0,11) == "event: goto_")

    {

    ID string: var link.href.substr = (11);

    for each (var tfl:TextFlowLine of in StandardFlowComposer (richText.textFlow.flowComposer) .lines)

    {

    If (TFL. Paragraph.ID is ID)

    {

    richText.verticalScrollPosition = tfl.y;

    break;

    }

    }

    }

    }

  • My wireless mouse works fine everywhere except in Mail. It is simply not to scroll or work at all.

    My wireless mouse works fine in all applications except Mail, where it does not at all. It is altogether we els and absent when I try to use it either as a pointer to a specific e-mail or use it to scroll. It simply is not there. What gives?

    Please could you tell us what operating system you are using.   It isn't iOS with an iMac.

  • Trackpads only 2 fingers scrolling on the Mac Mini

    I have two Magic trackpad (wireless), a couple of years; No will 2 fingers scrolling on my Mac Mini (try them for the first time on the Mini). both work fine on my other machines.  All machines are updated to the latest version of El Capitan, a lot of RAM.  Same settings trackpad on all machines.  The movement of the cursor trackpad, highlighting, click Select OK on the Mini, but no two fingers scrolling, without pinching to resize.  Have not checked all the possibilities, but lack of scrolling is a deal breaker.  Track pad update 1 is too old, have not found another.  Tried with mouse wireless on and outside.  A run first aid.  Reinstalled the system software.  Even enabled the scrolling options, the settings of the mouse.  Help!

    If two of your machines running El Capitan and touchpads are version 1 of Trackpad, it is probably the reason.   While versions more old mouse and trackpad will work to some extent, all the features with El Capitan requires the version of Magic Trackpad 2.   The MT2 has developed especially for El Capitan and later operating systems.   I know that it's a nuisance, but the new trackpad is levied directly on your machine and needs no battery.

  • Unable to scroll upwards or downwards with the iPhone iOS 10 6 s more

    With any screen with my iso 10, it is difficult to move or scroll. Is there an adjustment for this?

    It's the same thing with the home screens, it is difficult to move to the next set of icons or just

    scroll up and down with safari.

    Thank you

    Bill

    This has been fixed with orders to "hold time."

  • The scrolling behavior is not smooth after update to Mac OS Sierra

    After that the macOS update Sierra the scrolling behavior has changed, does anyone have same experiences?

    I can still scroll trough a Web page without a problem. I mean the scroll with 2 fingers on the touch pad or scroll with the magic mouse gesture.

    BUT: In trying to slowly scroll through long lists of selections, just answers touching on fast movements, not on the slow change.

    Steps to reproduce:

    Open a Web site like twitter and go to preferences. Go to the time zone list, open it, and scroll through it. Can you move the cursor to line by line?

    You can also move to http://www.doyouspain.com/mietwagen/ , select a country like the Spain a try to SLOWLY scroll list.

    (I just discovered: the list of operating system at the end of this page shows the same problems with PCMCIA)

    I found this behavior using "Parallels Desktop". I can't scroll the documents most as before the update.

    Hello!

    Please open the accessibility, to increase the scrolling speed move the slider from slow to fast (from left to right).

    A screenshot for reference.

    Thank you!

  • Scrolling problem

    I have the scrolling problem in netbeans IDE in my macBook pro early 2015 (retina 13 inches), somewhere that is extremely fast cannot see what is happening and in a place more slowly scrolling and not able to fix by increase or decrease scrolling speed of the trackpad in

    sys.pref-> accessibility.

    Everyone please help.

  • Why not with the work of the fingers to scroll after upgrading to the Sierra?

    I can't scroll with two fingers on the trackpad once I upgraded to Sierra. Any tips?

    Hello!

    Please open trackpad and check the meaning of natural area scroll.

    Thank you!

  • two fingers scrolling down does not work

    After the upgrade to OS Sierra my Macbook air (2015) trackpad scroll (two fingers) does not work. Please provide a solution. Thank you

    MacBook Air (13 inch, early 2015), OS X El Capitan (10.11.1)

    It took a little time, but I found a solution.

    1. In System Preferences, open accessibility.
    2. Use your keyboard to scroll down on the left side of the mouse and Trackpad.
    3. Click the Trackpad button.
    4. Uncheck scroll and click OK.
    5. Click the Trackpad button.
    6. Scroll to check again, and then click OK.
    7. Check that this set.

    It worked for me. Good luck to you!

  • Problems with scrolling after update

    IM currently using the BlueJ ide and after updating to the new system / update (macOS Sierra) there is significant lag / jitter when scrolling. This problem only occurs when you use the scrolling with two fingers with the touch pad. When I use a mouse / or click the scroll bar on the side, it seems to go well. Not sure if there is a problem with BlueJ or the new OS. Would be very interested for some suggestions on how to fix this very annoying problem. (Using a Macbook pro 13, 2015).

    Thanks a lot to all the answers

    The obvious question would be if you see the problem of scrolling in Mac OS standard applications such as Mail, Notes and Safari.

    If this isn't the case, it is likely BlueJ.

  • Whenever I try to open the App Store it will remain open for more than 30 seconds before the close. Or it just restarts as soon as a home screen scroll above him. I can't keep it open long enough to even download an application.

    Whenever I try to open the App Store it will remain open for more than 30 seconds before the close. Or it just restarts as soon as a home screen scroll above him. I can't keep it open long enough to even download an application.

    Hello monorayfromportland,

    If you are unable to connect to the iTunes Store on your Apple TV, take a look at the troubleshooting steps below:

    If you cannot connect to the iTunes Store

    If you cannot connect to the iTunes Store on your Apple TV (4th generation):

    1. Make sure that your date and time are correct. Go to settings > general > Date and time.
    2. Check if your Apple TV software is up-to-date. To check the updates, select settings > system > software updates > software update.
    3. Make sure you have an active network connection. Go to settings > network.
    4. Check to see if other devices, such as computers or tablets, can connect to Wi - Fi and access to the Internet.
    5. Reset the wireless router by turning and then again.

    Take care.

  • Safari 10 stuttering during scrolling

    After updating to Mac OS and safari 10, I noticed that when scrolling the page animation stutters when slowing down. It is not consistent, but it seems quite often. I can't do with extensions, after you disable Adblock (the only extension I was using) still stuttering. It is more pronounced when scrolling to the top of the bottom of the page, at average speed.

    Anyone else notice?

    Try Safari/Clear History. This will cause all your cookies to remove. Or you can go to the data of the site Web Safari/Preferences/Privacy / manage and delete all cookies except those of your bank, Apple and other sites you use.

  • Scroll too fast on java applications

    After update to sierra applications that use java in my case Intellij or even the java Control Panel, have increased the speed of scrolling. I use the trackpad so I don't know if the problem occurs with a mouse too. I tried to slow down to a minimum on the accessibility implementation, but it had no effect on java applications. It became really difficult to work. Is there a new setting that I should do or perhaps a work around?

    This is a bug in the JDK: https://bugs.openjdk.java.net/browse/JDK-8166591

    Explanation:

    It looks like the JDK question and is reproducible with a JList with simple scrolling. Sierra generates many more events than El captain. These events contain values ~0.1 planned instead ~ 1. But Java converts these small number 1 in any case.

    There is no solution except wait that Oracle will fix it.

  • PowerPoint for Mac bar vertical scrolling does not work in the Sierra

    I have downloaded Sierra, open a PowerPoint for Mac 2011 version 14.5.4 and immediately noticed that the vertical scroll with my mouse does not work. They're only going to 'up' (for example, slide 14, 13, 12, 11, 10) or will be stuck between 2 blades.

    I unplugged and replugged my mouse, turned PPT market twice and rebooted my MacBook. No change.

    I know it's early days and these are the pains of growth with the new OS, but I use PPTX constantly.

    Any tips are appreciated.

    Have the same problem. I don't know that this isn't a mouse problem because it happens when I use the touchpad as well.

  • Is there a way to enable horizontal scrolling is the Finder Windows?

    I just upgraded to Mac OS Sierra and noticed that the windows in the Finder now scroll vertically (up and down) with scroll on the right side bar and I can't change it to be able to scroll horizontally (left and right) with the bar scroll on the bottom. I was always able to scroll horizontally according to icon, if the option had been abandoned?

    Drag the upper or lower window.

     > System Preferences > Trackpad

     > System Preferences > General

Maybe you are looking for

  • Laptop turn on but the screen is completely black

    Hi guys,. I was wondering if someone have an idea as to why my laptop (which was working perfectly last night), now has a black screen when I try to turn it on.I read in some other forums who offered to take out the battery and hold the power button,

  • How to lock the start of a clip to a specific bar

    I'm working on a soundtrack to a movie, and like most people do this kind of work, I need to work with different tempos. I started with the clip, I placed so that the visual cue would correspond to 5 1 1 1 bar in my project of logic. Is where the mus

  • Unable to boot from usb drive on lenovo ideapad z585

    Hello I created a Memtest + USB key which works very well on my desktop PC but it will fail to start on my Lenovo Ideapad Z585, it just goes right to the quick connection of Windows 8 despite pressing F12 and selecting the Generic USB 2.0 device in t

  • ChnLinGenImp do not convert the value of units

    Hello I use the ChnLinGenImp command in a creation of such as channel below. --> Call ChnLinGenImp(SpecChannelName,length,SpecNumber*1,0,Unit) The question that I am running, I run the script for a conversion unit that converts the units if they are

  • How to restore my MSN account

    Error message read "is no longer valid, contact MSN customer service in order to restore an account."