This is my PHP:
<?php
header('Content-type: application/xml');
//config included
include_once ("config.php");
//this line selects the city
$result = mysql_query ("SELECT * FROM filmer");
// and output a XML document
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo '<helakatalog>';
//fitching all the entries
while ($row=mysql_fetch_assoc($result)) {
$line = '<id>'.$row['id'].'</id>';
$line1 = '<title>'.$row['title'].'</title>';
$line2 = '<year>'.$row['year'].'</year>';
$line3 = '<publisher>'.$row['publisher'].'</publisher>';
$line4 = '<genres>'.$row['genres'].'</genres>';
$line5 = '<image>'.$row['image'].'</image>';
$line6 = '<info>'.$row['info'].'</info>';
$line7 = '<link>'.$row['link'].'</link>';
$line8 = '<internet>'.$row['internet'].'</internet>';
$line9 = '<trailer>'.$row['trailer'].'</trailer>';
echo '<katalog>';
echo $line;
echo $line1;
echo $line2;
echo $line3;
echo $line4;
echo $line5;
echo $line6;
echo $line7;
echo $line8;
echo $line9;
echo '</katalog>';
}
echo '</helakatalog>';
?>
This is my mxml (it's the one i saved last without the
arrayutil.toarray function):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*" backgroundImage="@Embed('assets/images/Aqua_Blue.png')"
backgroundSize="100%">
<!-- <mx:Model id="katModel"
source="http://192.168.0.200:8080/flex/katalog/katalog.xml"/> -->
<mx:HTTPService id="katSrv"
url="http://192.168.0.200:8080/flex/katalog/katalog.xml"
resultFormat="xml"></mx:HTTPService>
<!--<mx:Model id="katModel"
source="http://192.168.0.200:8080/flex/katalog/katalog.xml"/>-->
<!-- The ActionScript code for this class is externalized in a
separate .as file for better readability -->
<mx:Script source="katalog_script.as"/>
<!-- Style sheet used in this application -->
<mx:Style source="katalog.css"/>
<!-- Design begins -->
<mx:VBox>
<mx:Label text="SerenadServer Film Katalog"
styleName="appTitle"/>
<mx:HBox id="hb" horizontalGap="4" height="555">
<mx:Panel id="main" title="Film Katalog" width="512"
height="100%">
<mx:ViewStack id="bodyStack" changeEffect="Fade"
width="100%" height="100%">
<!-- A custom component (ThumbnailView.mxml)
that displays the list of products in a Thumbnail view:
This is the view displayed when you start
the application. When the user clicks a product
(change event), we store the selected item
in the selectedItem instance variable of this application -->
<ThumbnailView id="thumbView"
label="Product Catalog"
dataObject="{katSrv.result.helakatalog.katalog}"
change="selectedItem=event.target.selectedItem"/>
<!-- A custom component (GridView.mxml)
providing another way (DataGrid) to look at the same data -->
<GridView id="gridView"
dataObject="{katSrv.result}"
change="selectedItem=event.target.selectedItem"/>
</mx:ViewStack>
<mx:ControlBar height="50">
<mx:ViewStack
id="controlStack">
<mx:HBox horizontalGap="0"
horizontalAlign="right">
<mx:Image source="{currentView=='thumb'?
thumbOn:thumbOff}" mouseDown="changeView('thumb')"
mouseOver="event.target.source=thumbRoll"
mouseOut="event.target.source=currentView=='thumb'?
thumbOn:thumbOff"/>
<mx:Image source="{currentView=='grid'?
listOn:listOff}" mouseDown="changeView('grid')"
mouseOver="event.target.source=listRoll"
mouseOut="event.target.source=currentView=='grid'?listOn:listOff"/>
</mx:HBox>
</mx:ViewStack>
</mx:ControlBar>
</mx:Panel>
<mx:VBox width="100%" height="100%">
<mx:Canvas id="topCanvas" width="370" height="355"
vScrollPolicy="off">
<MovieDetail id="movieDetail"
dataObject="{selectedItem}" width="100%" height="100%"
vScrollPolicy="off"/>
<PanelControl id="statusTop" width="100%"
resizeEvent="slide(event)"/>
</mx:Canvas>
<mx:Canvas id="bottomCanvas"
width="370" height="100%" vScrollPolicy="off">
<FindView id="findView" width="100%"
height="100%" itemSelected="selectedItem=event.target.selectedItem"
vScrollPolicy="off"/>
<PanelControl id="statusBottom" width="100%"
resizeEvent="slide(event)"/>
</mx:Canvas>
</mx:VBox>
</mx:HBox>
</mx:VBox>
</mx:Application>
--- In [email protected], Manish Jethani
<[EMAIL PROTECTED]> wrote:
> pioplacz wrote:
>
> > Maybe it sounds king of noobish but i'm a noob... but cannot get
it
> > to work... i tryed just passing the data from httpservice to
> > datagrid but the right data won't show... I'm getting all
> > confused.... maybe is something wrong with my php xml
output... :S
>
> Your XML output looks fine to me. A couple of things:
>
> 1. As Matt noted, you should use ArrayUtil.toArray() to make
sure your
> data provider is an array, not an object (happens when you have
only one
> node).
>
> 2. You need to allow access to external URLs by adding your URL
to the
> whitelist in flex-config.xml. I'm not an expert in this. Read the
docs.
>
> When you say "it's not working," what exactly is failing? Are you
> getting an error message? Are you setting up a fault handler for
your
> HTTPService and then swallowing the error? What format are you
getting
> the data in, object or xml?
>
> Show us some code and we can help you.
>
> As an aside, I've done something similar, here:
>
> http://manish.revise.org/archives/2005/02/04/blog-activity-
analyzer-written-in-flex/
>
> You might find it easier to copy the code and edit it to suit your
needs.
>
> Manish