PDA

Volledige versie bekijken : Hoe geef ik dit weer in flash


Robiņo
%Europe/Berlin %577 %2005, 14:52
hallo.

ik ben hier nieuw en nog een noob als het om flash gaat, maar ik wel het gaan leren.
PHP kan ik wel en ik heb dit script gemaakt:
<?php

error_reporting(E_ALL);

class musicplayer
{

var $aantalmp3s;

function mp3check($map)
{
chmod($map, 0777);
$handle = opendir($map);
if(file_exists($map."/playlist.m3u"))
{
unlink($map."/playlist.m3u");
}
$playlist = fopen($map."/playlist.m3u", "w");
fputs($playlist ,"#EXTM3U\n");
while(false != ($read = readdir($handle)))
{
if(is_file($map."/".$read))
{
$ext = explode(".", $map."/".$read);
$count = count($ext);
$count = $count - 1;

if($ext[$count] == "mp3")
{
fputs($playlist, $read."\n\n");
$file['mp3'][] = $read;
$this->aantalmp3s++;
}
}
}
closedir($handle);
return $file;
}
function mp3count()
{
return $this->aantalmp3s;

}
}
$musicplayer = new musicplayer;
?>

<html>

<head>
<title>PHP-MP3 Player</title>
</head>

<body bgcolor="#DDDDDD">

<center>

<table border="1" width="380">
<tr>
<td colspan="2"><p align="center"><b>Tracklist</b></p></td>
</tr>
<?php

$locatie = "muziek"; //zonder '/'

$mp3s = $musicplayer->mp3check($locatie);


$i=1;


foreach($mp3s['mp3'] as $mp3)
{
$mp3 = str_replace(".mp3", "", $mp3);
echo "<tr>";
echo "<td width=\"15\">".$i."</td>";
echo "<td width=\"365\">".$mp3."</td>";
echo "</tr>";

$i++;
}

?>
</table>

</center>

</body>

</html>

nu is mijn vraag... hoe zet ik dit om naar AS, of hoe laat ik de variabelen in?

Grtn Robin

Flasher
%Europe/Berlin %586 %2005, 15:04
in php echo je alles als var1=mp3&var2=bla&var3=blabla (1 lange string)
die laad je dan in in flash met een LoadVars object. (zie flash help of zoek naar LoadVars op dit forum)

Robiņo
%Europe/Berlin %587 %2005, 15:06
maar hoe zit dat dan bij mijn foreach() lus?

Flasher
%Europe/Berlin %601 %2005, 15:26
ik heb niet zoveel verstand van php, maar volgens mij wordt het dan dit:

$i=1;
$sendstring = "";
foreach($mp3s['mp3'] as $mp3)
{
$mp3 = str_replace(".mp3", "", $mp3);
$sendstring .= "&var".$i."=".$mp3;
$i++;
}
echo $sendstring;