Hi. I cant load images, can you help me.
code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.rpc.events.ResultEvent;
import flash.net.*;
import mx.collections.ArrayCollection;
[Bindable]
private var nodes:ArrayCollection;
[Bindable]
private var _img= new Image();
private function onResult(result):void{
trace(result);
_img=result;
nodes=new ArrayCollection(result);
}
private function onFault(result):void{
trace("onFault: " + result);
}
public var rr:FBTileList= new FBTileList();
private function init():void{
var conn:NetConnection = new NetConnection();
conn.connect("http://localhost/amfphp/gateway.php");
var folderResponder = new Responder(onResult, onFault);
conn.call("MyService.readFolder", folderResponder, "images");
// rr.x=91;rr.y=55;
//rr.dataProvider=nodes;
}
]]>
</mx:Script>
<mx:Image source="{_img}" />
<!-- <mx:TileList x="50" y="50" id="iii" dataProvider="{nodes}"
itemRenderer="TitleListRender" width="50%" height="50%"/>-->
</mx:Application><?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.rpc.events.ResultEvent;
import flash.net.*;
import mx.collections.ArrayCollection;
[Bindable]
private var _img= new Image();
private function onResult(result):void{
trace(result);
_img=result;
nodes=new ArrayCollection(result);
}
private function onFault(result):void{
trace("onFault: " + result);
}
private function init():void{
var conn:NetConnection = new NetConnection();
conn.connect("http://localhost/amfphp/gateway.php");
var folderResponder = new Responder(onResult, onFault);
conn.call("MyService.readFolder", folderResponder, "images");
}
]]>
</mx:Script>
<mx:Image source="{_img}" />
</mx:Application>
and PHP
....
public function readFolder($folder){
$d = dir($folder) or die("Wrong path: $image_file_path");
while (false !== ($entry = $d->read())) {
if($entry != '.' && $entry != '..' &&
!is_dir($dir.$entry))
$images[] = $entry;
}
$d->close();
return $images;
}
}
....
I have array of images and need to display the images.