TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-10-2009, 01:26 AM   #1 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 3
Thanks: 1
chunL is on a distinguished road
Default How use PHP to read image files from a folder and display them in Flex 3 tilelist.

Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code

PHP :
PHP Code:
<?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();
?>
FLEX 3 :

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">


<mx:Script>
<![CDATA[

import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.rpc.events.ResultEvent;


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: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:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>




<mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>


</mx:Application>
Thanks. Need help as soon as possbile. URGENT.


Tags - added by codefreak - Note from mod: please read,
Prettifying Pasted Code on TalkPHP
Thank you, and have a nice day.

Last edited by codefreek : 07-10-2009 at 06:48 AM. Reason: TAGS - has been added - http://www.talkphp.com/lounge/4563-prettifying-pasted-code-talkphp.html
chunL is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:06 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design