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
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
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
Old 07-10-2009, 06:45 AM   #2 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

Note: please use code tags.

/mod.
codefreek is offline  
Reply With Quote
Old 07-10-2009, 09:26 AM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by codefreek View Post
Note: please use code tags.

/mod.
Hmm, I thought you were a moderator for development team, what made you become a super moderator?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 07-10-2009, 10:22 AM   #4 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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!
Salathe is offline  
Reply With Quote
Old 07-10-2009, 11:41 AM   #5 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 3
Thanks: 1
chunL is on a distinguished road
Default

alright thanks!
chunL is offline  
Reply With Quote
Old 07-10-2009, 01:06 PM   #6 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
Show me, I need a good orgasm. okat that was wrong
It really was.
Salathe is offline  
Reply With Quote
Old 07-10-2009, 02:36 PM   #7 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
It really was.
I second that.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 07-10-2009, 03:02 PM   #8 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

I did it on purpose
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 07-10-2009, 04:39 PM   #9 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

It was still pretty bad
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 07-10-2009, 06:30 PM   #10 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Enfernikus View Post
It was still pretty bad
Yeah it was very random, I apologize. We cool?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 07-11-2009, 03:24 AM   #11 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

@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
codefreek is offline  
Reply With Quote
The Following User Says Thank You to codefreek For This Useful Post:
chunL (07-13-2009)
Old 07-13-2009, 01:37 AM   #12 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 3
Thanks: 1
chunL is on a distinguished road
Default

Thanks codefreek!
chunL is offline  
Reply With Quote
Old 07-13-2009, 01:49 AM   #13 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

You are welcome.
codefreek is offline  
Reply With Quote
Reply



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 05:46 AM.

 
     

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