Hello,
I'm working on an application in which students uses data like the times of tides. It uses an rss-feed to fill up an Arraycollection, it cuts out the times and then put those times in a datagrid. I have a neat little table in a Tilewindow. Here's the code:
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
title="
Getijdentabel (Oostende)" xmlns:p="*" width="734" height="258" creationComplete="test.send()" verticalScrollPolicy="off" horizontalScrollPolicy="off" showCloseButton="true" close="PopUpManager.removePopUp(this);"
>
<mx:Script>
<![CDATA[
importmx.collections.ArrayCollection;
importmx.rpc.events.ResultEvent;
importmx.managers.PopUpManager;
importmx.controls.Text;
importmx.controls.Alert;
[
Bindable]
private vargetijdenData:ArrayCollection;
function resultHandler(event:ResultEvent):void{
getijdenData = test.lastResult.rss.channel.item;
for(vari:uint = 0; i<getijdenData.length; i++){
if(test.lastResult.rss.channel.item[i].description.slice(538,541) =="ter"
)
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(543,548);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(620,625);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(726,731);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(775,780);
}
if(test.lastResult.rss.channel.item[i].description.slice(537,540) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(542,547);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(619,624);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(724,729);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(773,778);
}
if(test.lastResult.rss.channel.item[i].description.slice(534,537) =="ter"
)
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(539,544);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(616,621);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(718,723);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(767,772);
}
if(test.lastResult.rss.channel.item[i].description.slice(539,542) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(544,549);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(621,626);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(728,733);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(777,782);
}
if(test.lastResult.rss.channel.item[i].description.slice(540,543) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(545,550);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(622,627);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(729,734);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(778,783);
}
}
}
]]>
</mx:Script>
<mx:HTTPService id="test" url="http://www.mumm.ac.be/NL/Models/Operational/Tides/rss.php?oostende" result="resultHandler(event)"/>
<mx:Canvas width="100%" height="100%">
<mx:DataGrid dataProvider="{getijdenData}" id="recente_getijden" color="0x323232" rowCount="7" editable="false" width="100%" height="163" enabled="true" verticalScrollPolicy="off">
<mx:columns>
<mx:DataGridColumn dataField="title" headerText="Datum" width="80"/>
<mx:DataGridColumn dataField="hoog1" headerText="Tijdstip van hoog water" width="105"/>
<mx:DataGridColumn dataField="laag1" headerText="Tijdstip van laag water" width="105"/>
<mx:DataGridColumn dataField="hoog2" headerText="Tijdstip van hoog water" width="105"/>
<mx:DataGridColumn dataField="laag2" headerText="Tijdstip van laag water" width="105"/>
</mx:columns>
</mx:DataGrid>
<mx:Text text="Bron: Bestuurseenheid Mathematisch Model van de Noordzee mumm.ac.be" color="#CCCCCC" width="448" y="170" left="0"/>
<mx:Button label="Gegevens inlezen" y="170" right="0" click="test.send()"/>
</mx:Canvas></mx:TitleWindow>
It works fine
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
title="
Getijdentabel (Oostende)" xmlns:p="*" width="734" height="258" creationComplete="test.send()" initialize="test.send()" verticalScrollPolicy="off" horizontalScrollPolicy="off" showCloseButton="true" close="PopUpManager.removePopUp(this);">
<mx:Script>
<![CDATA[
importmx.collections.ArrayCollection;
importmx.rpc.events.ResultEvent;
importmx.managers.PopUpManager;
importmx.controls.Text;
importmx.controls.Alert;
[
Bindable]
private vargetijdenData:ArrayCollection;
function resultHandler(event:ResultEvent):void{
getijdenData = test.lastResult.rss.channel.item;
for(vari:uint = 0; i<getijdenData.length; i++){
//test.lastResult.rss.channel.item[i].description = test.lastResult.rss.channel.item[i].description.slice(620,625);
if(test.lastResult.rss.channel.item[i].description.slice(538,541) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(543,548);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(620,625);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(726,731);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(775,780);
}
if(test.lastResult.rss.channel.item[i].description.slice(537,540) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(542,547);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(619,624);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(724,729);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(773,778);
}
if(test.lastResult.rss.channel.item[i].description.slice(536,539) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(541,546);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(618,623);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(722,727);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(771,776);
}
if(test.lastResult.rss.channel.item[i].description.slice(535,538) =="ter")
{
test.lastResult.rss.channel.item[i].hoog1 = test.lastResult.rss.channel.item[i].description.slice(540,545);
test.lastResult.rss.channel.item[i].laag1 = test.lastResult.rss.channel.item[i].description.slice(617,622);
test.lastResult.rss.channel.item[i].hoog2 = test.lastResult.rss.channel.item[i].description.slice(720,725);
test.lastResult.rss.channel.item[i].laag2 = test.lastResult.rss.channel.item[i].description.slice(769,774);
}
}
}
]]>
</mx:Script>
<mx:HTTPService id="test" url="http://www.mumm.ac.be/NL/Models/Operational/Tides/rss.php?oostende" result="resultHandler(event)"/>
<mx:Canvas width="100%" height="100%">
<mx:DataGrid dataProvider="{getijdenData}" id="recente_getijden" color="0x323232" rowCount="7" editable="false" width="100%" height="163" enabled="true" verticalScrollPolicy="off">
<mx:columns>
<mx:DataGridColumn dataField="title" headerText="Datum" width="80"/>
<mx:DataGridColumn dataField="hoog1" headerText="Tijdstip van hoog water" width="105"/>
<mx:DataGridColumn dataField="laag1" headerText="Tijdstip van laag water" width="105"/>
<mx:DataGridColumn dataField="hoog2" headerText="Tijdstip van hoog water" width="105"/>
<mx:DataGridColumn dataField="laag2" headerText="Tijdstip van laag water" width="105"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
</mx:TitleWindow>
It works fine on my computer, but it fails when I've uploaded it to the server. Any hints to solve this problem? Bear in mind I'm not a professional programmer.
Have a nice weekend,
Bart
Geography and sciences teacher
PS. I added
<mx:Button label="Gegevens inlezen" y="170" right="0" click="test.send()"/> but even this won't work.
Views
Replies
Total Likes
http://www.mumm.ac.be/NL/Models/Operational/Tides/rss.php?oostende
needs to allow your swf file to connect and invoke the service
its done by adding crossdomain.xml file to that server,
Views
Replies
Total Likes