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

Similar Messages

  • JList run time errors when removing items from list

    Hi there
    I am having trouble removing items from a JList. For a While it was working fine and now it outputs runtime errors everytime samething gets removed from the lsit
    Here is the code
    //declare
    public class Consumertab1gui extends JPanel implements ActionListener
         public static JList conList = null;
         private static DefaultListModel model = null;
    // Create a list with some items
    model = new DefaultListModel();
    conList = new JList(model);
    //set the size of cells in the list with the length of the string
    conList.setPrototypeCellValue("Lenght 1234567890");
    conList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    conList.addListSelectionListener(new ValueReporter());
    //set a scroll onto the list
    JScrollPane conScroll = new JScrollPane(conList);
    add(conScroll,c);
    //when the button gets pressed to drop the selected item the following code is called
    private void dropConsumer()
    int selItem=0;
    componentsV.comVRemove(conList.getSelectedValue().toString());
    selItem=conList.getSelectedIndex();
    System.out.println("No:"+(model.getSize()-1));
    System.out.println("S:"+selItem);
    remConList(selItem);
    dropCon.setEnabled(false);
    //which in turns calls this
    public void remConList(int pos)
         model.remove(pos);
    when the model.remove(pos) code is executed the following runtime errors are given:
    java.lang.NullPointerException
    at Consumertab1gui$ValueReporter.valueChanged(Consumertab1gui.java:197)
    at javax.swing.JList.fireSelectionValueChanged(JList.java:1321)
    at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1335)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
    at javax.swing.DefaultListSelectionModel.removeIndexInterval(DefaultListSelectionModel.java:546)
    at javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(BasicListUI.java:1561)
    at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:160)
    at javax.swing.DefaultListModel.remove(DefaultListModel.java:478)
    at Consumertab1gui.remConList(Consumertab1gui.java:38)
    at Consumertab1gui.dropConsumer(Consumertab1gui.java:58)
    at Consumertab1gui.actionPerformed(Consumertab1gui.java:46)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    can anyone spot any mistakes in the code or suggest possible resons as to why these run time errors occur?
    Thanks
    alexis

    java.lang.NullPointerException
    at Consumertab1gui$ValueReporter.valueChanged(Consumertab1gui.java:197)The NullPointerException occurs at line 197, in the valueChanged method of your ValueReporter inner class. I have looked through your post several times but I don't see where you posted that method. Anyway, that is where you should look.
    PC²

  • How can i remove items from list that have been deleted when i click on them it keeps showing empty

    how can i remove items from the list that have been deleted when i click on them it keeps showing folder empty

    Actually, Reader SHOULD keep showing documents that no longer exist, I disagree. It's no big deal, and people will quickly realise why they can't open the file. They open more files, the old ones move off.
    The REASON why it should not check is that checking whether a file exists can take a long time when things aren't good. For instance if a file server goes down, or a memory card is unplugged. That in turn would mean delays opening the File menu, and I've seen some software that can sit there for several minutes. That would really give people something of which to complain...

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

  • Removing items from list

    hi all,
    i am having a list in which there are 4 elements in it.
    i need to remove the first and third elements in the list and make an iterator out of the modofied list
    i can create the iterator but can any one help me in removing specific elements in the list
    regards and thanks in advance

    i have seen this .there is no method to removeitems
    at specific locations
    sigh
    What is
    [url=http://java.sun.com/j2se/1.5.0/docs/api/java/util
    /List.html#remove(int)]this then ?This forum needs an introductory list of tips and
    tricks. Very high on
    that list should be a link to the JavaDoc API
    documentation or a link to
    the download site where everyone could download the
    darn thing.
    Now the question remains: how to make everybody
    read those API docs?
    kind regards,
    Jos
    I sadly suspect there needs to be a tutorial on HOW to read the API docs. :(
    PS For future question on deletions just ask the Sun admins as they would be the experts.

  • How can we remove items from the VF04 list?

    We have a long list of items in VF04 that, for various reasons (some process related, some due to errors), are not to be billed. We have looked at applying filters to the list but there is nothing really suitable to hide these individual documents e.g. we could filter out some dates where none of the items on that date are to be billed but other dates have a mix of items we want to bill and others we don't.
    I have done a search of this forum but didn't find a previous topic with a quick and simple method to remove items from the list .
    Is there a method, other than billing them or sorting each issue individually, to permanently remove individual documents from the VF04 list?
    Thanks in advance for any help.
    David

    Hi,
    David,
    Download a list of Pending delivers doc form VF04.
    Paste the list in T.Code : VL09 (Delivery reversal) and reverse the delivery.
    Then go to T.Code: VL06G Select the list of deliveries that has been reversed, select/delete all un- wanted deliveries.
    This way you can remove all unwanted pending deliveries forn Billing due list (VF04).
    Thanks & Regards,
    R.Janakiraman

  • HT5429 How do I remove items from the "current location/to" list?

    In MAPS, how do I remove items from the "current location/to" list?

    Hit the book icon and you will see delete all option. I have not found a way to delete them one at a time.

  • Removing items from itunes wish list

    iTunes will currently NOT let me remove items from my wish list inside the itunes store. Even when I've selected the item to buy, it stays in my wish list... I need to remove items that have either been purchased, or that I no longer wish to buy. Thanks for the help!

    Looks like it's not just you having problems : https://discussions.apple.com/thread/3093114?tstart=0
    Normally pressing the 'x' on or next to the item should delete it (http://support.apple.com/kb/HT1368), but it doesn't appear to be working at the moment.

  • How to remove items from my reading lists on my ipad?

    how to remove items from my reading lists on my ipad?

    Swipe across its name in the list and it should get a Delete button on it - tap that and it should be removed from the list

  • How to remove item from my iPhone and iPad on my reading list?

    How to remove item from my iPhone and iPad on my reading list?

    Swipe across its name in the list and it should get a Delete button on it - tap that and it should be removed from the list

  • Removing Items from a TextArea/Pane Component

    Hi All,
    I have a question about text containers. Basically I'm reading Strings from a file and I'm displaying them inside a JTextArea. I'm adding new Strings to the JTextArea using it's append() method. Is there a way to limit how much stuff should the JTextArea hold ? After a while my application crashes with the following message:
    java.lang.OutOfMemoryError
         <<no stack trace available>>
    Exception in thread "main"
    This is because so much stuff got accumulated in the JTextArea that it eats up all available memory and the app crashes. My question is; is there a way I can remove items from the JTextArea ? Or is there a way to limit the size/number of Stings it can hold ? Or should I be using something else instead of the JTextArea ? Thanks in advance...
    -Pete

    int size = textArea.getDocument().getLength();
    gives the total number of bytes in the text area. You can then use:
    textArea.replaceRange("", 0, 80);
    to remove 80 characters from the start of the text area. Or to remove the first line from the text area use:
    int start = textArea.getLineStartOffset(0);
    int end = textArea.getLineEndOffset(0);
    textArea.replaceRange("", start, end);
    Design your own routine to keep the text area at a reasonable size.

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

  • Selecting multiple rows from List-component

    Hi
    Could someone give me an example how to programmatically select multiple rows from List-component?
    I know that this selects one row: lst_example.selectedIndex = 1;
    But how about selectin indexes 1,2 and 4 for example?

    selectedIndices
    A Vector of ints representing the indices of the currently selected item or
    items...
    var si:Vector.<int> = new Vector.<int>;
    si.push(1);
    si.push(2);
    si.push(4);
    list.selectedIndices = si;

  • Pick queue item to work on, check "Also remove item from queue(s)" - where did it go?

    We recently upgraded from CRM 2011 to 2015.
    When users pick a queue item to work on, and check "Also remove item from Queue" - where does it go?  I cannot find a view that lists these items anywhere???

    Hi This depends on, which entity is in the queue. If it is an opportunity it could be found in opportunities If it is an email it could be found in activities etc. If you upgraded from crm2013, where could you find it before update to crm2015? Hope it
    helps. Gr.peb

  • How do i remove items from my cloud

    how do I remove items from my cloud

    You'd have to go into the various apps on your device that store data on iCloud and begin trimming files.  For example, Contacts and emails that are stored on icloud, must be deleted using the Contacts and Mail apps.  Be aware that deleting data from icloud will also remove if from your device.
    Backups:
    Go to Settings>iCloud>Storage & Backups>Manage Storage; there, tap the device you need info on and the resulting screen lists Backup Options with which apps store data on iCloud.  Turn off camera roll and any other apps that might have a lot of data.  Then delete the backup.  That will free up space.  Photos should be regularly synced to a computer (like you store photos from a digital camera) using either USB via iTunes (on a mac use iPhoto or Aperture to move them to an album) or using photo stream. Go to Settings>iCloud and turn that feature on. 
    Emails:
    Regarding emails, on the computer, move emails from mailboxes in icloud to those on the device.  That can also save a lot of space.
    Also see:  http://support.apple.com/kb/ht4847

Maybe you are looking for

  • I got the Blue Screen-But Not After Installing Leopard

    I have not installed anything recently. Except Quake 4 but haven't even run it yet. I Rebuilt my Permissions and Restarted and suddenly got the Blue Screen. I had to hold down the power button and reboot. This is the first time it's ever happened. Af

  • STAD Not showing data in CRM 5.0

    DEar Firends, We upgraded CRM from 4.0 to 5.0 , but when we execute STAD Transaction code and puting i/p for yesterday or today or 10 day before then it show screen but without any record. So how can i achived statistic record. reply. Thanks, Rd, Sac

  • Colorsync/Display issue after repairing permissions

    I'm working on a friends Mac with OS 3.9. She hasn't repaired permissions since Panther came out. Her computer was super slow, so I ran the repair. Display was perfect before the repairs. It completely improved the system but after the reboot the dis

  • Error when importing XML

    Hi, I get the following error when using the XML import on a Ehp1 SP05 system: The termination type was: RABAX_STATE The ABAP call stack was:       Method: CONVERT_BACKEND_EXCEPTION of program CL_FDT_WD_SERVICE=============CP       Method: IF_FDT_WD_

  • Catching the results of tcode into a custom program

    Hi Experts I need to call the t-code IP19 (program name is RIMHIS00) with input values from a custom program and need to capture the results of IP19(structure : rimhis01) into a internal table in custom program for further processing. Can anybody hel