TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   How use PHP to read image files from a folder and display them in Flex 3 tilelist. (http://www.talkphp.com/absolute-beginners/4711-how-use-php-read-image-files-folder-display-them-flex-3-tilelist.html)

chunL 07-10-2009 01:26 AM

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,
http://www.talkphp.com/lounge/4563-p...e-talkphp.html
Thank you, and have a nice day.

codefreek 07-10-2009 06:45 AM

Note: please use code tags.

/mod.

Orc 07-10-2009 09:26 AM

Quote:

Originally Posted by codefreek (Post 26828)
Note: please use code tags.

/mod.

Hmm, I thought you were a moderator for development team, what made you become a super moderator? :-P

Salathe 07-10-2009 10:22 AM

I'm not sure this is the right site for your question, we're PHP guys here not Flex heroes. There'll probably be some overlap but you'd get a quicker/better/more-useful answer on a Flex forum. That said, I may take a look at this post later when things aren't so hectic.

Offtopic: Orc, we made him a super mod because of his amazing good looks, obviously! :-)

chunL 07-10-2009 11:41 AM

alright thanks!

Salathe 07-10-2009 01:06 PM

Quote:

Originally Posted by Orc (Post 26841)
Show me, I need a good orgasm. okat that was wrong *!*

It really was. :-/

sketchMedia 07-10-2009 02:36 PM

Quote:

Originally Posted by Salathe (Post 26842)
It really was. :-/

I second that. :-!

Orc 07-10-2009 03:02 PM

I did it on purpose :-D

Enfernikus 07-10-2009 04:39 PM

It was still pretty bad :-!

Orc 07-10-2009 06:30 PM

Quote:

Originally Posted by Enfernikus (Post 26854)
It was still pretty bad :-!

Yeah it was very random, I apologize. We cool? :-D^^

codefreek 07-11-2009 03:24 AM

@chunL, forums that might be able to offer you the assistance, you are seeking.


http://www.kirupa.com/forum/
http://forums.adobe.com/community/flex
http://flexfreaks.com/forums/

let me know if there is anything else i can help you with.

-Cf

chunL 07-13-2009 01:37 AM

Thanks codefreek!

codefreek 07-13-2009 01:49 AM

You are welcome.


All times are GMT. The time now is 06:43 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0