getting a List control to visibly scroll through actionscript

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default getting a List control to visibly scroll through actionscript

    OK so i've created this list control that is bound to a static XML file as the
    model. I also have a textInput control that serves as a typeahead to select an
    item from the list control. I have the attached action script class which i
    invoke on the textInput.change event. I've bound some labels on the form to
    various[listControl.dataProvider.selectedItem.columnName]'s and the action
    script class IS working because, as I type in the textInput box, the labels
    change to reveal the next item in the list, alphabetically. so here's the
    problem: the list does not visibly 'scroll' to the item that's selected.
    i.e. my list will display 3 rows vertically (there are more than 2,000 rows in
    it's dataProvider, though). if I type in ab, it will move from highlighting
    the first person's name on the list to highlighting the 2nd person's name on
    the list, and display the details from the dataProvider of that person in the
    bound labels on the page. but if i type in, say, cr - getting to a name
    that's about 300 items down in the list, the bound labels will change on the
    form to display the correct information, and you can then subsequently mash
    down the scroll down arrow in the list box until you get to the first person
    whose name starts w/ cr and see that the item is actually selected
    (highlighted) in the list, but it's not visually obvious that it's selected
    because, until you use the scroll buttons, the list control still shows the
    names of the people starting with a in the 3 items that you can actually see
    without manually scrolling. I'm sure i'm just missing a call to a (probably
    inherited) method of the list control - but i've checked the object hierarchy
    and can't find anything anywhere. basically i need something that says 'show
    the currently-selected item at the top of the displayed space'. I hope this
    makes sense. any help TIA!

    // ActionScript Document
    import mx.core.Application;
    class TypeAhead
    {
    // constructor
    public function TypeAhead()
    {}
    static function moveMySpot():String
    {
    var theSelectList = Application.application.lstPeopleList;
    var theTypeAhead = Application.application.txtTypeAhead;
    var strTypedString:String = theTypeAhead.text.toUpperCase();

    if(strTypedString == "")
    {
    theSelectList.selectedIndex = -1;
    }
    else
    {
    var theDP = theSelectList.dataProvider;
    var j:Number = theDP.length;
    for (var i:Number = 0 ; i < j ; i++)
    {
    if (theDP[i].nF.toUpperCase() >= strTypedString)
    {
    theSelectList.selectedIndex = i;
    //here's
    where i need some help!! (i think)
    return;
    }
    }
    }
    }
    }

    toofless Guest

  2. Similar Questions and Discussions

    1. How do you get a list of records to scroll automaticallyinstead of page
      I have a set of records displayed in a list control. The list currently pages through the records and displays two records at a time. I want to...
    2. why won't my list component scroll?
      i'm having some problems getting the scrollbar to function with my listbox. i know that there must be a simple solution, but after searching for...
    3. Get a word out of a scroll-list(see pic)
      hi Rob, it is a textfield. When I am using: currentWord = member("leiste_links").word put currentWord I get the whole list ??? In the...
    4. Flash Actionscript List or Forum
      Hello all, I've been doing PHP for a little while now... I am starting learn Action Script now... and having trouble with global variables and...
    5. Mouse Scroll in Combo List
      Thanks Stephen. "Stephen Lebans" <StephenLebans@mvps.org> wrote in message news:%23pr$SxoRDHA.2252@TK2MSFTNGP12.phx.gbl...
  3. #2

    Default Re: getting a List control to visibly scroll throughaction script

    nevermind - fluffysocks answered it in an earlier post. the line of code was:
    ListObject.vPosition = intNewSelectedIndex; thanks fluffysocks! next time I
    guess I'll search the board a little better before wasting everyone's time!

    toofless Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139