I have a problem with getting data into flash through php can someone pleas help. i have a mc with a textfield inside of it and I use --onClipEvent (data) {
this.play();}
in the first frame of the mc is --
fla_body = "";
loadVariables("broadcast.php?"+(Math.random()*1000 000), this);
stop();
below is the phpcode (//flash part) is where it should happen
PHP Code:<?php
/* this function takes a given string and does an explode by [url]
*
*/
function createLink($url){
// $tmp = a temporary array created by the explode function
$tmp = explode("[url]",$url);
// sizeof(anygivenarray) = number of elements in the array
for ($i=1; $i<sizeof($tmp)-1; $i+=2){
// creates a link out of the given url
$tmp[$i]="<a href=\"http://".$tmp[$i]."\" target=\"blank\">".$tmp[$i]."</a>";
}
// returns a string from the array $tmp
return implode("",$tmp);
}
function createmailto($email){
$tmp = explode("[email]",$email);
for ($i=1; $i<sizeof($tmp)-1; $i+=2){
$tmp[$i]="<a href=\"mailto:".$tmp[$i]."\">".$tmp[$i]." </a>";
}
return implode("",$tmp);
}
// this includes the database connection
include "broadcast.inc";
// query the table news and sorts them, this is done in oder to present the last entry at the top of the table insted of the bottom
$result = mysql_query("SELECT * FROM news ORDER BY posted ASC");
// Count the number of rows in $result, $result is the above var. that selects the table news
$num_of_rows = mysql_num_rows($result);
//echo $num_of_rows;
//this part makes the table for the content to be displayed in
echo'<table width="200" border="0" class="linespacingbcast">';
//this for loop counts $num_of_rows backwards until it is less than zero;
for (-- $num_of_rows; $num_of_rows >= 0; $num_of_rows --){
echo'
<tr>
<td><span class="b-norm1"> '.mysql_result($result,$num_of_rows,"author").' </span>
<span class="bcast-date"> '.strftime("%a %d/%m/%y %H:%M", mysql_result($result,$num_of_rows,"posted")).'</span> <br>
<span class="bcastnorm"> '. createmailto(createLink(mysql_result($result,$num_of_rows,"body"))).'</span></td>
</tr>';
}
echo '</table>';
//flash part
$fla_author = mysql_result($result,$num_of_rows,"author");
$fla_posted = strftime("%a %d/%m/%y %H:%M", mysql_result($result,$num_of_rows,"posted"));
$fla_body = createmailto(createLink(mysql_result($result,$num_of_rows,"body")));
print "&fla_body=" .urldecode($fla_body);




Reply With Quote