AS3 / PHP new scene HELP

west cost

New Member
Messages
2
Reaction score
0
Points
1
i wanna go to a new scene but don't know how. I'll post the code below. Hope u can help. Thanks!

[actionscript]

import flash.display.MovieClip;
import flash.events.*;
import flash.net.*;
import flash.text.*;

submit_button.buttonMode = true;

submit_button.addEventListener(MouseEvent.MOUSE_DOWN, checkLogin);


username.text = "";
password.text = "";

function checkLogin (e:MouseEvent):void {

if (username.text == "" || password.text == "") {



if (username.text == "") {

username.text = "Enter your username";

}

if (password.text == "") {

password.text = "Enter your password";

}

} else {



processLogin();

}

}


function processLogin ():void {


//variables that we send to the php file
var phpVars:URLVariables = new URLVariables();

//we create a URLRequest variable. This gets the php file path.
var phpFileRequest:URLRequest = new URLRequest("http://localhost/Login/phpFile/controlpanel.php");



phpFileRequest.method = URLRequestMethod.POST;



phpFileRequest.data = phpVars;



var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);



phpVars.systemCall = "checkLogin";
phpVars.username = username.text;
phpVars.password = password.text;



phpLoader.load(phpFileRequest);

}



function showResult (event:Event):void {



result_text.autoSize = TextFieldAutoSize.LEFT;



result_text.text = "" + event.target.data.systemResult;

}

PHP:
<?php


//connect to our database
include_once "connect.php";

//we post the variables we recieve from flash

$username = $_POST['username'];
$password = $_POST['password'];


if ($_POST['systemCall'] == "checkLogin") {


$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";

$query = mysql_query($sql);

$login_counter = mysql_num_rows($query);

if ($login_counter > 0) {

while ($data = mysql_fetch_array($query)) {

$userbio = $data["user_bio"];

print "systemResult=$userbio";

}

} else {

print "systemResult=The login details dont match our records.";

}

}

?>
 
Top