Jump to content

Using PHP to read images from folder and then display in Adobe FLEX 3


chunL

Recommended Posts

hello. I need help trying to display images on Adobe FLEX 3 tileList using PHP. Im able to use PHP to read images from folder but im not able to display the images on Adobe FLEX 3 <mx: TileList>. Here are my current codes

 

FLEX 3 :

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 

xmlns:ns1="Components.UnitSelector.*" viewSourceURL="srcview/index.html" >

 

<!--><mx:RemoteObject id="myservice" fault="faultHandler(event)" showBusyCursor="true" source="flashservices.picture" destination="amfphp">

        <mx:method name="sayHello" result="resultHandler(event)" />

    </mx:RemoteObject><-->

 

 

<mx:Script>

<![CDATA[

 

import mx.controls.Alert;

import mx.events.FlexEvent;

import mx.rpc.events.FaultEvent;

import mx.events.ItemClickEvent;

import mx.collections.ArrayCollection;

import mx.rpc.events.ResultEvent;

import Components.UnitSelector.TileListItemRenderer;

 

public var image:Object;

 

private function resultHandler(event:ResultEvent):void

{

 

image = (event.result);

ta1.text = String(event.result);

 

}

 

private function faultHandler(event:FaultEvent):void

{

 

ta1.text = "Fault Response from HTTPService call:\n ";

 

]]>

</mx:Script>

 

<mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}"

                              width="630" height="149"/>

 

<mx:TextArea x="80" y="326" width="182" height="221" id="ta1" editable="false"/>

 

<mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>

<mx:HTTPService id="pic" url="{phpPicture}" method="POST"

result="{resultHandler(event)}" fault="{faultHandler(event)}"/>

 

 

</mx:Application>

 

 

 

 

PHP:

 

<?php

//Open images directory

 

$imglist = '';

 

$dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");

 

//List files in images directory

while (($file = $dir->read()) !== false)

{

if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))

    echo "filename: " . $file . "\n";

}

 

$dir->close();

?>

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.