Highlighted default item in list component???

I can't seem to find how to have an item in a list component
highlighted by default. I'm sure its right there in the docs
staring me down, but I dont see it.
I've found scrollToIndex method, but that doesnt seem to
actually highlight the index item. How do I highlight an index item
in a list in as3?
Thanks,
Matt

Oh, I forgot to mention that I am using ActionScript 3.

Similar Messages

  • Cannot get more than 8 item in list component

    Hi,
    I can't get more than 8 items in list component using getItemAt(), it returns null. I will search more for this but no result.
    Please Help me here to move to next step.
    Thanks
    Sureshkumar G

    If you're asking if you can overall, yes you can:
    http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f41.html
    If you're asking if you can do this in the same context, off-screen, no you still get the same error as the .enabled property.
    I hate to throw a hunch but I feel as though Adobe is employing something I'm used to in native iOS programming (Apple Devices). In lists they have something called "dequeue". It's the reason an extremely long list scrolls smoothly. What it does is render ONLY the rows that are in view. When a row is about to scroll off view it deallocates it from memory and then recreates the next row. They do this so you only ever have the current amount of viewable rows in memory and it speeds up scrolling. Although, I can make property changes to items in an iOS list that's off-screen so they don't have this issue ;(.  Just food for thought.
    I'd submit it to the bugbase and see what Adobe states. They may say they intend you to get the item in view, alter it and then go back to your previous position. That would be silly but at most I can tell you I definitely get errors trying to access an element outside my view. They're probably not used to items needing visual toggles when you can't even see them.
    edit:
    On a further note I tried the scrollToIndex() method, tried to disable, that much worked fine. The second I then scrolled back to the previously selected index the list screwed up.
    I even daisy chained functions a second apart (30 frames worth of wait). I scrolled down and that worked so I waited 1 second. I disabled the visible item I wanted to and that worked so I waited another second. I scrollToIndex(0) to get back to the top of the list, the list blew up. Random items (several items) were disabled and the one that I explicitly disabled was enabled.

  • Scroll one item in List component

    Hello!
    I use List component for song list in my flash music player. Everything works ok except for one problem - when the name of the song is too long, user can't read the full name of the song. One solution would be to use the horizontal scroll bar, but I have a better solution on mind: would like the current song automatically scroll (go around like in mp3 players). I guess I have to get current song's DisplayObject, to change it's x coordinate, but how? Maybe there are other solutions?
    Thanks in advance,
    elvman

    Oh, I forgot to mention that I am using ActionScript 3.

  • Removing items from List Component

    Below is a function set that's used to get info from an XML
    source(s) and populate a List Component (videoList). Works great.
    The second function loads data from a separate XML source and
    populates the SAME List Component. When the second function is
    called it loads the data in addition to the existing data into the
    List Component. I want it to REPLACE the data. How would I
    accomplish this?
    public function getXMLdata(event:Event):void {
    var campXML:XML = new XML(xmlLoader.data);
    var vid:XML;
    for each(vid in campXML.vid) {
    videoList.addItem({label:vid.attribute("desc").toXMLString(),
    data:vid.attribute("src").toXMLString(),
    text:vid.attribute("text").toXMLString()});;
    videoList.selectedIndex = 0;
    videoList.addEventListener(Event.CHANGE, playnewvid);
    FLVPlayer.source = videoList.selectedItem.data;
    FLVPlayer.pause();
    clipText.text = videoList.selectedItem.text;
    public function getXMLdata2(event:Event):void {
    var nflXML:XML = new XML(xmlLoader2.data);
    var vid:XML;
    for each(vid in nflXML.vid) {
    videoList.addItem({label:vid.attribute("desc").toXMLString(),
    data:vid.attribute("src").toXMLString(),
    text:vid.attribute("text").toXMLString()});;
    videoList.selectedIndex = 0;
    videoList.addEventListener(Event.CHANGE, playnewvid);
    FLVPlayer.source = videoList.selectedItem.data;
    FLVPlayer.pause();
    clipText.text = videoList.selectedItem.text;
    }

    That took 2 minutes! Works like a charm Manno. Thank you for
    your response.
    For those curious, here's the solution:
    public function getXMLdata(event:MouseEvent):void {
    videoList.removeAll();
    var campXML:XML = new XML(xmlLoader.data);
    var vid:XML;
    for each(vid in campXML.vid) {
    videoList.addItem({label:vid.attribute("desc").toXMLString(),
    data:vid.attribute("src").toXMLString(),
    text:vid.attribute("text").toXMLString()});;
    videoList.selectedIndex = 0;
    videoList.addEventListener(Event.CHANGE, playnewvid);
    FLVPlayer.source = videoList.selectedItem.data;
    FLVPlayer.pause();
    clipText.text = videoList.selectedItem.text;
    public function getXMLdata2(event:MouseEvent):void {
    videoList.removeAll();
    var nflXML:XML = new XML(xmlLoader2.data);
    var vid:XML;
    for each(vid in nflXML.vid) {
    videoList.addItem({label:vid.attribute("desc").toXMLString(),
    data:vid.attribute("src").toXMLString(),
    text:vid.attribute("text").toXMLString()});;
    videoList.selectedIndex = 0;
    videoList.addEventListener(Event.CHANGE, playnewvid);
    FLVPlayer.source = videoList.selectedItem.data;
    FLVPlayer.pause();
    clipText.text = videoList.selectedItem.text;
    }

  • Show/hide items in list component possible?

    Hi all,
    I'm quite a newbie in Flash, and more so in components.
    Currently, I'm working on a project that works in this way:
    I've got a combo box with 5 items, and a list with 10 items. The
    combo box works like a filter and when selected on an item, the
    list should only show items pertaining to the selection. For eg, my
    5 items in the combo box are the alphabets A,B,C,D,E. My 50 items
    in the list are some country names. So when "C" in the combo box is
    selected, the list should display countries starting with C, like
    Canada, China, and so on..
    Let's say my indexes for C in the list are 10-15, is it
    possible to hide items with index 0-9, and 16-49? I tried searching
    but it seems there isn't a show/hide function for list
    components.

    quote:
    Originally posted by:
    NedWebs
    What you can probably do is rewrite the list each time a
    combo box selection is made. Have the full list as an array, so
    that when a combo box selection is made, its change function clears
    the list and then rewrites it based on matching the combo box label
    to the first character of each array element.
    Thanks, your comments helped!

  • POST all items from list component

    I've got an "List-component". Within this component I have an
    x amounth of data-values liked to a "label". I would like to POST
    those data-values to my server (in this case PHP, but thats not
    important). I would like to do this together with
    "TextInput-component".
    To be clear. I don't want to post just the selected values,
    but all de values in the List-component. Who can help me?

    Loop over the dataProvider, and build whatever data transport
    structure you like, then POST that.
    I am partial to XML.

  • Default item category for components in task list

    Hii all,
    I need one help. We need to maintain default item category for components in task list.
    Currently it comes as "L" and the field is non editable.
    Is there any way wherein i can edit the item category to "N" or any other. Also need to know why this category "L" appears?
    I can brint the default item category in the service order by the standard config.(PM/CS--> Maint & serv processing --> Main & Service orders --> General data --> define default values for component item categories)
    But i want it in the task list.
    Please help
    Regards,
    Vijay

    Hi Vijay,
    Just go to task list and then to component. go to item category field and press F1 (help)
    its mention
    Item Category (Bill of Material)
    Categorization of the items in a BOM according to set criteria, such as whether they refer to an object (for example, material master or document info record) or whether they are kept in stock.
    To my knowledge It wont be possilbe have item category N in task list by directly adding material.
    Hi Pete,
    Correct me if i am wrong that configuration setting for default material type and item category works for orders only.

  • Highlight color in list component

    Hi there
    Can anybody tell me how to change the color from the default blue that the list component uses for the currently selected item.
    myList.highlightColor = something; ??
    Many thanks

    - Doubleclick your list.  -> goto frame 2
    - Doubleclick the 3. (Cell Renderer Skins)  -> goto frame 2
    and you will see
    there you can doubleclick preferred over, down states...

  • Highlight current Index label in list component

    Hi,
    I'm writhing http xml video playlist. i was took 'List' component for playlist.
    if i click on label, that is working (i mean playing video & highlighting label).
    but after video ending, video automatically playing but label not highlighting, How can i highlight current playing video label?
    Code:
    var videoURL:String = "playlist_http.xml";
    var bolLoaded:Boolean;;
    var intActiveVid:int;
    var urlLoader:URLLoader;
    var urlRequest:URLRequest;
    var xmlPlaylist:XML;
    var nConnection:NetConnection;
    var ns:NetStream;
    var video:Video = new Video();
    nConnection = new NetConnection();
    nConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    nConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    nConnection.connect(null);
    function connectStream():void
              ns = new NetStream(nConnection);
              ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
              ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, ayncErrorHandler);
              ns.checkPolicyFile = true;
              ns.client = this;
              vidDisplay.attachNetStream(ns);
              ns.play(videoURL);
              vidDisplay.smoothing = true;
              urlRequest = new URLRequest(videoURL);
              urlLoader = new URLLoader();
              urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
              urlLoader.load(urlRequest);
    function netStatusHandler(event:NetStatusEvent):void
              trace(event.info.code);
              switch (event.info.code)
                        case "NetConnection.Connect.Success" :
                                  connectStream();
                                  break;
                        case "NetConnection.Connect.Closed" :
                                  break;
                        case "NetStream.Play.Stop" :
                                  playNext();
                                  break;
                        default :
    function securityErrorHandler(event:SecurityErrorEvent):void
              trace("securityErrorHandler: " + event);
    function ayncErrorHandler(event: AsyncErrorEvent):void
              //Nothing
    //PlayList SetUp
    //=====================
    var listBox:List = new List();
    addChild(listBox);
    listBox.setSize(194, 339);
    listBox.move(484,0);
    function playlistLoaded(e:Event):void {
              xmlPlaylist = new XML(urlLoader.data);
              //trace(xmlPlaylist.vid[0].@src);
        for (var i:int=0;i<xmlPlaylist.vid.length();i++) {
                                  listBox.addItem({label:xmlPlaylist.vid[i].attribute("desc"), data:xmlPlaylist.vid[i].@src});
                                  listBox.addEventListener(Event.CHANGE, playVidlist);
                                  listBox.selectedIndex = 0;
    // set source of the first video but don't play it
              playVid(0, false);
              if(!bolLoaded) {
                        ns.play(videoURL);
                        bolLoaded = true;
              else{
                        ns.resume();
    function playVidlist(e:Event):void
              //intActiveVid=int(String(e.currentTarget.selectedItem.data));
              ns.play(String(e.currentTarget.selectedItem.data));
              lblDescription.text = e.currentTarget.selectedItem.label;
              if(!bolLoaded) {
                        ns.play(videoURL);
                        bolLoaded = true;
              else{
                        ns.resume();
    function playVid(intVid:int = 0, bolPlay = true):void {
              if(bolPlay) {
                        // play requested video
                        ns.play(String(xmlPlaylist..vid[intVid].@src));
              } else {
                        videoURL = xmlPlaylist..vid[intVid].@src;
              lblDescription.text = String(xmlPlaylist..vid[intVid].@desc);
              // update active video number
              intActiveVid = intVid;
    function playNext(e:MouseEvent = null):void {
              if(intActiveVid + 1 < xmlPlaylist..vid.length()){
                                  playVid(intActiveVid + 1);
    function playPrevious(e:MouseEvent = null):void {
              // check if we're not and the beginning of the playlist and go back
              if(intActiveVid - 1 >= 0)
                        playVid(intActiveVid - 1);

    Thankyou.... working good, but after adding next previous buttons that selection not working currectly.
    if i click some label, selection is working after if i click next not working selection.
    function playNext(e:MouseEvent = null):void {
               if(intActiveVid + 1 < xmlPlaylist..vid.length()){
                                  playVid(intActiveVid + 1);
      listBox.selectedIndex = intActiveVid + 1;
    function playPrevious(e:MouseEvent = null):void {
              if(intActiveVid - 1 >= 0)
    playVid(intActiveVid - 1);
    listBox.selectedIndex = intActiveVid - 1;

  • How can I select an item from a list component with a seperate button

    This is a repost, I decided it'd probably be better here than
    in the general discussion board. I will try to delete the other
    one.
    Hello Everyone,
    This is my first post here. I am trying to figure out how to
    select an item within a list component with a button. This button
    is calling a function. I have searched for the past 3 hours online
    and I can't find anything about it. I thought perhaps I could set
    the selectedItem parameter, but that is read only, and I believe it
    returns an object reference rather than something like a number so
    even if i could set it, it would be pointless. I also found a get
    focus button, thought that may lead me somewhere, but I think that
    is for setting which component has focus currently as far as typing
    in and things like that. I am lost.
    Basically I am looking for a way to type this
    myList.setSelected(5); where 5 is the 5th item in the list.
    Any help would be much appreciated.

    Never mind found it. It is the property called selectedIndex
    and it is writable

  • Displaying items in different colors in a List component

    Hi.
    How can I make each label of an item in a List component
    appear in a different color? I can change the color of the items in
    the list, but I want the items to appear in different colors...
    Thanks,
    - Yuval

    Hi.
    How can I make each label of an item in a List component
    appear in a different color? I can change the color of the items in
    the list, but I want the items to appear in different colors...
    Thanks,
    - Yuval

  • List Component - return number of item clicked

    I have populated a List component with data from an XML file.  I simply want the index of the line clicked returned so I can gotoAndStop to that Frame number. I have found the 'selectedItem' property but I don't want the text, I want the number of the line. Thanks.

    You said you wanted the index of the line clicked, so you don't need to look further than the selectedIndex value.  There is no data property for the selectedIndex value (which is merely a number);
    trace(event.target.selectedIndex);
    Now if your intention is to associate this with a frame number, then you have to adjust for index values starting at 0 and frame numbers starting at 1.

  • List component row manipulation

    I have two questions regarding as3 list component:
    - I'd like to highlight and keep selected the item a user last selected from my list component. I've combed the live reference as well as google and must be typing the wrong search words. I can tell what label and index an item was that was selected but am not finding a way to highlight and keep highlighted the user's choice in the list component.
    - Also, I'm exploring the notion of inline buttons within a list's rows. If a user hovers their mouse over a row, a set of small buttons come up the user can click on for further functionality. This may be more of a make your own component answer but I'm exploring it nonetheless. Any thoughts or comments on this?
    Thanks!

    no something else is going on. Or perhaps you didn't explain your problem clearly.
    After servlet b calls getList() you have two servlets each having a reference to the same list
    A------\
    List
    B------/

  • Creating search field for a list component

    i have created a glossary of terms using the list component and populating it via an XML file.
    what i would like to do is create a search field that as the user types in the search bar if there are any matching entries in the list, the focus/selection jumps to that particular item in list. i don't want to clear the list just go to the item that matches.
    i would like it to be predictive so if i have these entries:
    samson
    seek
    seether
    south
    and the user types "s" in the search box to the first "s" entry in the list (samson) is selected, if they type "se" the selection jumps to the first entry with "se" in it (seek) if they type "seet" the selection jumps to "seether" and so on.
    i have absolutely no idea how to do it, but more importantly...is this possible?
    i have attached the sample files that i have been working on.
    thanks in advance

    You need the lowercase. the keyCode of the keybpardevent returns the key's uppercase charcode. So the A-key allways returns 65. Therefore convert keycode to char and to lowercase before appending after what's allready there in the field.
    To have the user not have to type the words with proper casing, convert the label to lowercase before doing the indexOf search.
    import fl.data.DataProvider;
    //-------declare vars----------------
    var firstClick:Boolean=true;
    var loader:URLLoader = new URLLoader();
    var dp:DataProvider = new DataProvider();
    var xml:XML;
    //-------add listeners---------------
    loader.addEventListener(Event.COMPLETE,onLoaded);
    glossary.lb.addEventListener(Event.CHANGE, itemChange);
    glossary.search_bar.addEventListener( FocusEvent.FOCUS_IN, clearbox );
    glossary.search_bar.addEventListener( KeyboardEvent.KEY_DOWN, onSearch );
    //-------functions--------------------
    //clears the input field when the user clicks into it for the first time
    //eliminates the need for them to highlight and delete the "type search here" text
    function clearbox( e:FocusEvent ):void {
        if (firstClick==true) {
            glossary.search_bar.text="";
            firstClick=false;
    //populate description box with definition when item is selected
    function itemChange(e:Event):void {
        glossary.ta.text=glossary.lb.selectedItem.data;
    //creates the data provider for the list based off external XML file
    //arranges the items in alphabetical order
    //populates the list
    function onLoaded(e:Event):void {
        xml=new XML(e.target.data);
        var il:XMLList=xml.channel.item;
        for (var i:uint=0; i<il.length(); i++) {
            dp.addItem({data:il.description.text()[i],label:il.title.text()[i]});
        dp.sortOn("label");
        glossary.lb.dataProvider=dp;
        glossary.ta.text="Please make a selection below";
    //dynamic search engine to locate items in the list
    function onSearch( e:KeyboardEvent ):void {
        trace( e.keyCode );
        var input:String = ( glossary.search_bar.text + String.fromCharCode( e.keyCode ).toLowerCase() );
        trace( input )
        for (var i:uint = 0; i < dp.length; i++) {
            if (dp.getItemAt(i).label.toLowerCase().indexOf(input)==0) {
                glossary.lb.selectedIndex=i;
                glossary.ta.text=glossary.lb.selectedItem.data;
                break;
            } else {
                glossary.ta.text="no matching searches";
    //-------load the xml--------------
    loader.load(new URLRequest("xml/movie1.xml"));

  • Animate List component

    hello everyone,
    I've been working with Flex 3 for over a year and really want
    to get into customizing components the best way possible, so i've
    been digging into the classes. my first task is to create a smooth
    tween when scrolling a List component instead of the default
    "jumping" motion. So i decided to extend the list and do some
    function overriding:
    override protected function moveRowVertically(i:int,
    numCols:int, moveBlockDistance:Number):void
    var r:IListItemRenderer;
    trace(String(listItems
    [j]));
    for (var j:int = 0; j < numCols; j++)
    r = listItems[j];
    prev_y
    = r.y + moveBlockDistance;
    //trace(r.y +" "+(r.y+ moveBlockDistance)+" "+prev_y);
    TweenMax.to(r,0.5,{y:(r.y +
    moveBlockDistance),ease:Sine.easeOut});
    //r.move(r.x, r.y + moveBlockDistance);
    rowInfo
    .y += moveBlockDistance;
    I've found moveRowVertically to be the method that actually
    does the vertical row movement (called from the scrollVertically
    method in the ListBase class). As you can see, i've added the
    TweenMax where the object's move method was. This works
    normally when the tween time is set to 0 sec, the List scroll
    effect is the same as the stock component. But when TweenMax.to is
    changed to 0.5 sec, the animation behaves strangely. I believe this
    is partly because when a new object appears in the list it is
    immediately added to the list, so the method that controls the
    addChild needs to have the TweenMax animation also applied to. But
    also, there is another problem, when you click the scroll arrow
    before the TweenMax animation is complete, this function uses the
    current y poisition (in the middle of the animation) as opposed to
    the end y position- when the animation is complete. This is why the
    TweenMax positions the items correctly when the TweenMax duration
    is set to 0.
    I
    have an example here.
    When you click the scroll arrow and wait for the animation to
    complete, it works as the code expects. But when you click too fast
    or scroll the scrollbar thumb, you can see the unexpected behavior.
    SO what I believe needs to be added to the code is an array
    that stores the end y coordinate and have the class use that
    instead of the current y coordinate. I believe the best way to do
    this is to store the end y coordinate in the listItems
    [j] array so that i could call: TweenMax.to(r.end_y +
    moveBlockDistance),ease:Sine.easeOut}); and all would be fine (for
    the objects in the display, hopefully). But i cannot find the
    original as file where the listItems property is (aka:
    listContent.listItems as defined in the listItems get and set
    methods in ListBase.as). Here i could extend this and define a
    custom property. But a more important question is this: is it
    possible to define a custom property on the fly, so i wouldn't have
    to extend the listContent object (therefore, extending ListBase,
    then List... on down the line)?
    thank you all for your help!

    Ok I found out that it works fine in IE but not in FirefoX
    HOWEVER it does work fine in Firefox from another computer! I tried
    clearing out the cache but NOTHING...chan ANYONE PLEASE HELP
    ME???

Maybe you are looking for