PDA

View Full Version : variable values from php to flash 5


oceansky
10-05-2001, 01:57 PM
Sorry for answering this question again. However, have been searching on the boards, reading all the tutor, sorry for my stupid, I still cannot figure out how to export the data from php to flash.

I am building a simple scrolling box on _level2, with variable "scrolltext".

Here is my as script in flash and my php script, any mistake? If it was too long to read, please read the following ##### part only, Thank You!

##########################
as: loadVariables("http://www.birdview.com.hk/phpmyagenda/flash.php3", "_level2.ScrollBox");
php: print "&scrolltext=$allflash";
##########################



onClipEvent (load) {
// Setting the variables for the Scrolling script
loadVariables("http://www.birdview.com.hk/phpmyagenda/flash.php3", "_level2.ScrollBox");
scrolling = 0;
frameCounter = 1;
speedFactor = 1;
}
onClipEvent (enterFrame) {
if (frameCounter % speedFactor == 0) {
if (scrolling == "up") {
scrolltext.scroll -= 1;
} else if (scrolling == "down") {
scrolltext.scroll += 1;
}
frameCounter = 0;
}
frameCounter += 1;
}



<?php

$agendauser = 1;
include ("application.php3");

if(!isset($rootagenda))
$rootagenda="";

$language = "chinese";
setcookie("language" , $language);

include($rootagenda."lang/$language.lang.php3");
include ($rootagenda."admin/include/place.inc.php3");

$req_listevents = "SELECT e.id , e.title, e.description, e.contact1, e.contact2, e.contact3, e.contact4, e.contact5 , t.type , d.start
FROM events e, eventtype t , date d
WHERE t.id = e.type
AND d.event = e.id
AND d.start >= NOW()
ORDER BY d.start ASC
LIMIT 0 , 5";
debug("listing request = $req_listevents");
$qid = db_query($req_listevents);
// mode soon


// input value to temp

$flash = array("", "", "", "", "");

$n = 1;
$temptype = "";
$temptitle = "";
$tempdescription = "";
$tempdates = "";
$tempplace = "";
while ($r = db_fetch_object($qid)) {
$temptype = $r->type;
$temptitle = $r->title;
$tempdescription = $r->description;

$qidate = db_query("SELECT start, end, place.name FROM date,place WHERE date.place = place.id AND date.event = '$r->id' ORDER BY date.start");
while($dates = db_fetch_object($qidate))
{
$tempdates = dispdate($dates->start , $dates->end , $language);
$tempplace = $dates->name;
}
db_free_result($qidate);

$flash[$n] = "<font size=16 color=#33FFFF>"."$temptype"."ĄG "."$temptitle"."<br>"."<font size=12 color=#CCCCFF>"."$tempdescription"."</font>"."<br>"."<font size=10>"."$tempdates"."<br>"."$tempplace"."</font>"."</font>"."<br><br>";

$n = $n + 1;
} db_free_result($qid);

// input value to temp


// transfer the string value to flash
$allflash = "$flash[1]$flash[2]$flash[3]$flash[4]$flash[5]";

print "&scrolltext=$allflash";

?>

Jesse
10-06-2001, 02:43 AM
That should work. If you cut out the flash and just run the PHP script, does it print that line of text into the browser as you would expect?

oceansky
10-06-2001, 05:57 AM
Thanks, Jesse. Yes, when I just run the PHP script, it print that line of text into the browser as I expected. Thus, it make me confused. :confused:

I just read from the books that the variables should be URL-encoded. Is it related to my problem?

oceansky
10-06-2001, 07:15 AM
Figure it out!

the <font> tag is "<font size='10'>", not "<font size=10>"
What a stupid mistake!
Sorry wasting your time, and thanks Jesse again. :D