HI NEED MAJOR HELP. I’m trying to make a game where u answer questions about the various countries of the Europpean Union .I have a 500+ question database, with 20 questions for each of the 27 countries of the Europpean Union. The problem is that i cant link lots of stuffs that i’m not too familiarized with, in terms of programming. The objective is when choosing a country through a button, it gets 3 random questions out the 20 of that country. Then if u get all the questions right( 3) u get an item. I dont know how to make the dynamic boxes clickable. How can i make the flash recognize the right answer? PLZ I NEED HELP.
The structure of the database is:
QUestion
id
correctanswer
answer1
answer2
answer3
My questions are:
How can i link 3 random questions of the country i select
The codes are these ones:
PHP:
<?php require_once(‘Connections/db_con.php’); ?>
<?php
$pais = “italia” ;
/$pergunta1_f = $_POST[‘pergunta1’];
$pergunta2_f = $_POST[‘pergunta2’];
$pergunta3_f = $_POST[‘pergunta3’];/
$output = “”;
mysql_select_db($database_db_con, $db_con);
$query_Recordset1 = “SELECT * FROM $pais ORDER BY RAND()”;
//$query_Recordset1 = “SELECT * FROM portugal”;
$Recordset1 = mysql_query($query_Recordset1, $db_con) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php for ($n=1; $n<=3; $n++) {
$output .= “correcta”.$n."=".$row_Recordset1[‘correcta’]."&pergunta".$n."=".$row_Recordset1[‘pergunta’]."&resposta".$n.“1=”.$row_Recordset1[‘resposta1’]."&resposta".$n.“2=”.$row_Recordset1[‘resposta2’]."&resposta".$n.“3=”.$row_Recordset1[‘resposta3’]."&";
$row_Recordset1 = mysql_fetch_assoc($Recordset1);}
$output = substr($output,0,-1);
echo($output);
?>
<?php
mysql_free_result($Recordset1);
?>
FLASH:
var request:URLRequest = new URLRequest (“http://localhost/phpToFlash.php”);
request.method = URLRequestMethod.POST;
var vars:URLVariables = new URLVariables();
vars.pais = “portugal”;
request.data = vars;
var phpVars:URLLoader = new URLLoader();
phpVars.addEventListener(Event.COMPLETE, go);
phpVars.dataFormat = URLLoaderDataFormat.VARIABLES;
phpVars.load(request);
function go(e:Event):void {
vars = phpVars.data;
/* trace(vars.correcta2);
trace(vars.pergunta2);
trace(vars.resposta21);
trace(vars.resposta22);
trace(vars.resposta23);
*/
resposta1.addEventListener(MouseEvent.CLICK,res);
resposta2.addEventListener(MouseEvent.CLICK,res2);
resposta3.addEventListener(MouseEvent.CLICK,res3);
perguntas.text=(vars.pergunta2);
function res (e:MouseEvent) :void{
(vars.resposta21);
}
function res2 (e:MouseEvent) :void{
(vars.resposta22);
}
function res3 (e:MouseEvent) :void{
(vars.resposta23);
}
PLZ HELP. IF U CAN HELP,THANKS A LOT.