
The metode that we will use in the proses is using LoadVars. In this case, the data that will be shown at Flash, is being comunicatewith methode GET using protokol HTTP. BasicallyFlash accept the data from HTTP header, using several format. Which is with seperating sign ‘&’ and ‘=’, for example ‘&variabel01=isi01$variabel2=isi02’.
So to make an output containt like showing above, then server side scripting must be able to make an aoutput data like this:
“&welcome=Web site ini adalah media memberikan informasi kepada masyarakat mengenai kebutuhan ketenaga kerjaan di rumah sakit kami. Disini anda di persilahkan memperkenalkan diri anda kepada kami, ada formulir dasar yang harus anda isi. Anda dapat memberikan data kepada kami dalam bentuk file (dokumen atau pun gambar). Anda akan mendapatkan user dan login yang akan anda pergunakan untuk melakukan test pendahuluan, melihat hasil test dan mengisi forum.&judul=SELAMAT DATANG”
Which the text ‘&welcome’ to explained containt variable and ‘$judul’ to explain header variable . Data after sign mark ‘=’ is a data that shown at Flash.
The code at server side using php code as follow:
include"lib/sambung.php";
$query=mysql_query("select * from welcome where id = 1");
$dataquery=mysql_fetch_array($query);
echo "&welcome=";
echo"$dataquery[isi]";
echo "&judul=";
echo"$dataquery[judul]";
?>
Then at Flash we write the code at first frame movie on the first layer with array function as follow :
System.useCodepage = true;
format = new TextFormat();
text1.html = true;
text1.text = "Loading news...";
temp = new LoadVars();
temp.load("welcome.php");
temp.onLoad = function(){
myArray = new Array();
for(var a in this){
myArray.push(this[a]);
}
text1.text = myArray[1];
}
Here we can see that to make a record from data base to Flash must be done in repeating step of coding. First you must array it at PHP and by flash the data must we array it one more time in order to get the data array. This happened because the data array consist of one line or paragraf data.
No comments:
Post a Comment