I have populated a php page where i pull image in that php. Now how can i put those image in flash by array. The php code is
<?PHP
$link = mysql_connect("localhost","root","");
mysql_select_db("dbname");
$query = "SE开发者_运维百科LECT * FROM dress where dress_type='shirts' AND sex='male'";
$results = mysql_query($query);
while($row = mysql_fetch_assoc($results))
{
$path = $row["imagelocation"];
$final = "<img src='$path' width='100' height='100'>\n";
echo "$final";
}
mysql_close($link);
?>
Change:
$path = $row["imagelocation"];
$final = "<img src='$path' width='100' height='100'>\n";
echo "$final";
To this:
$path = $row["imagelocation"];
echo $path . "#";
This way you get a Hash delimited list of all your image paths.
Then when you load that PHP document you'll be able to create an array of all your image paths:
var ldr:URLLoader = new URLLoader(
new URLRequest("your_php_file.php")
);
ldr.addEventListener(Event.COMPLETE, _done);
function _done(e:Event):void
{
ldr.removeEventListener(Event.COMPLETE, _done);
var ar:Array = String(e.target.data).split("#");
for each(var i:String in ar)
{
var img:Loader = new Loader();
img.load(new URLRequest(i));
addChild(img);
}
}
精彩评论