# Filter trouble as3

**URL:** <https://forum.kirupa.com/t/filter-trouble-as3/328991>\
**Category:** flash\
**Created:** [July 10, 2012, 11:56am UTC](https://forum.kirupa.com/t/filter-trouble-as3/328991 "2012-07-10T11:56:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Otelejo](https://avatars.discourse-cdn.com/v4/letter/o/e480ec/32.png) [@Otelejo](https://forum.kirupa.com/u/Otelejo)\
**Post date:** [July 10, 2012, 11:56am UTC](https://forum.kirupa.com/t/filter-trouble-as3/328991/1 "2012-07-10T11:56:27Z")

</div>

Hi!

I’m making a digital sign in flash that shows the weather forecast from an RSS feed, with the time and a description of the weather being displayed. The problem is that I want to filter out all the items that describe the weather at midnight (00:00 in the title).

The feed is taken from [http://feeds.feedburner.com/yr/NTbA?format=xml](http://feeds.feedburner.com/yr/NTbA?format=xml) and looks like this basically:

```auto
<item>
      <title>Tuesday 10 July 2012 at 18:00</title>
      <description>Rain. 20°C at 18:00. Strong breeze, 6 m/s from south. 2.2 – 8 mm mm precipitation between 18 and 00.</description>
</item>

<item>
      <title>Wednesday 11 July 2012 at 00:00</title>
      <description>Rain. 16°C at 00:00. Strong breeze, 6 m/s from northwest. 2.3 – 7 mm mm precipitation between 00 and 06.</description>
    </item>
    
<item>
     <title>Wednesday 11 July 2012 at 06:00</title>
      <description>Rain. 15°C at 06:00. Moderate breeze, 4 m/s from southwest. 1.2 – 3.2 mm mm precipitation between 06 and 12.</description>
</item>

....

```

I’ve split the tag so that I can isolate the time. Then I use that variable (clocka[5]) to filter an XMLList called midnatt.

When I trace that list, I get the output I want, the items with a title tag containing 00:00 are removed. Perfect!

trace(tittel)

Tuesday 10 July 2012 at 18:00  
Wednesday 11 July 2012 at 06:00  
Wednesday 11 July 2012 at 12:00  
Wednesday 11 July 2012 at 18:00  
Thursday 12 July 2012 at 06:00  
…

However, when I split the tittel to again isolate the time, and then trace it, I get undefined in the output. Shouldn’t this trace be filtered the same way as the previous one?

trace(tidpunkt[5])

18:00  
undefined  
06:00  
12:00  
18:00  
undefined  
06:00

My question is: What is the best way to filter out items that contain a tag that contain a certain string? And, what am I not getting here? I bet it’s something basic but I cannot seem to google my way past it.

Any help would be much appreciated!

My as3 looks like this:

```auto
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("http://feeds.feedburner.com/yr/NTbA?format=xml"));
loader.addEventListener(Event.COMPLETE, handleComplete);

function handleComplete ( event:Event ) :void 

{
    var rawXML = new XML (loader.data);

    var items:XMLList = rawXML.channel.item;
    
    for each (var item:XML in items) {
        
    var title = item.title;
    var clocka = title.split(" "); 
    var clockSlag = clocka[5]
    
    var midnatt:XMLList = item.(clockSlag != "00:00");
    
    var tittel = midnatt.title.toString();
    //trace(tittel);
    var tidpunkt = tittel.split(" ");
    trace(tidpunkt[5]);
    
}
    
}

```
