Hi All,
I am following Adam Koury tutorial on developphp.com for building a community website and I am stuck with the flash header for last 2 days. My header (which is completey same as Adam’s header). Also the checkuserlog.php and other scripts are exactly same as Adam’s have provided. The issue in my case is header stuck to 1st frame and is not going to 2nd and 3rd frame, no matter what I do. I am attaching the header.fla (I tried but size constraint of 74kb is not allowing me, so I am posting the code for all 3 frames)and posting the checkuserlog.php code. If someone can help me, it be really great!.
checkuserlog.php
<?php
session_start();
if ($_POST[‘post_code’] == “check_log”)
{
if (!isset($_SESSION[‘id’]))
{
print “return_msg = not_logged_in”;
exit();
}
else
{
$id = $_SESSION[‘id’];
$firstname = $_SESSION[‘firstname’];
print “member_id=$id&member;_name=$firstname”;
exit();
}
}
?>
Action script:
Frame1
————————-
stop();
// Assign a variable name for our URLVariables object
var vars:URLVariables = new URLVariables();
// Build the varLoader variable
var varLoader1:URLLoader = new URLLoader;
varLoader1.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader1.addEventListener(Event.COMPLETE, completeHandler1);
// Build the varSend variable
var varSend1:URLRequest = new URLRequest(“scripts/checkuserlog.php”);
varSend1.method = URLRequestMethod.POST;
varSend1.data = vars;
// Handler for PHP script completion and return
function completeHandler1(event:Event):void{
if (event.target.data.return_msg == “not_logged_in”) {
//trace(event.target.data.id);
//trace(event.target.data.member_name);
gotoAndStop(2);
} else {
//trace(event.target.data.id);
//trace(event.target.data.member_name);
welcome_txt.text = event.target.data.member_name;
gotoAndStop(3);
}
}
vars.post_code = “check_log”;
varLoader1.load(varSend1);
——————————————
Frame2 (not_logged)
—————————————
stop();
//email_txt.tabIndex = 1;
//password_txt.tabIndex = 2;
//sumbit_btn.tabIndex = 3;
////////////
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
// Build the varSend variable
var varSend:URLRequest = new URLRequest(“http://www.ashok.webatu.com/scripts/login.php”);
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
// Handler for PHP script completion and return
function completeHandler(event:Event):void{
status_txt.text ="";
if (event.target.data.return_msg == "no_good") {
status_txt.text = "No match in our records, please try again";
} else if (event.target.data.return_msg == “all_good”) {
var reloadPage:URLRequest = new URLRequest("NewWindow=.reload(); NewWindow.focus(); void(0);");
navigateToURL(reloadPage, "_self");
}
}
// Add an event listener for the submit button and what function to run
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
// Validate form fields and send the variables when submit button is clicked
function ValidateAndSend(event:MouseEvent):void{
status_txt.text ="";
//validate form fields
if(!email_txt.length) {
status_txt.text = "Please enter your email address.";
} else if(!password_txt.length) {
status_txt.text = "Please enter your password.";
} else {
// Ready the variables for sending
variables.email = email_txt.text;
variables.pass = password_txt.text;
// Send the data to the php file
varLoader.load(varSend);
status_txt.text = "Processing…";
} // close else after form validation
} // Close ValidateAndSend function //////////////////////////////////////////////////////////////
———————————
Frame3(logged_in)
——————————-
stop();
var logOutVars:URLVariables = new URLVariables();
var logOutURL:URLRequest = new URLRequest(“http://www.ashok.webatu.com/scripts/logout.php”);
logOutURL.method = URLRequestMethod.POST;
logOutURL.data = logOutVars;
var logOutLoader:URLLoader = new URLLoader;
logOutLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
logOutLoader.addEventListener(Event.COMPLETE, completeLogOut);
logout_btn.addEventListener(MouseEvent.CLICK, logUserOut);
// Function to run when the logout button is pressed
function logUserOut(event:MouseEvent):void{
// Ready the variables here for sending to PHP
logOutVars.post_code = "log_out";
// Send the data to the php file
logOutLoader.load(logOutURL);
welcome_txt.text = "Processing request…";
//gotoAndStop("not_logged_in");
} // Close logUserOut function ///////////////////////////////////////
// Function for when the PHP file talks back to flash
function completeLogOut(event:Event):void{
if (event.target.data.replyMsg == "success") {
//gotoAndStop("not_logged_in");
var refreshPage:URLRequest = new URLRequest("NewWindow=.reload(); NewWindow.focus(); void(0);");
navigateToURL(refreshPage, "_self");
}
} // Close completeLogOut function //////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Code for the View profile Button
var viewProfile:URLRequest = new URLRequest(“http://www.ashok.webatu.com[URL=“http://www.yourwebsite.com/profile.php%E2%80%9D%29;”]/profile.php”);
viewProfile_btn.addEventListener(MouseEvent.CLICK, viewProfileClick);
function viewProfileClick(event:MouseEvent):void {
navigateToURL(viewProfile, “_self”);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Code for the Edit profile Button
var editProfile:URLRequest = new URLRequest(“http://www.ashok.webatu.com[URL=“http://www.webintersect.com/edit_profile.php%E2%80%9D%29;”]/edit_profile.php”);
edit_btn.addEventListener(MouseEvent.CLICK, editProfileClick);
function editProfileClick(event:MouseEvent):void {
navigateToURL(editProfile, “_self”);
}
———————————————
Thanks in advance!
PS: I have also tried putting the frame name instead of frame number but none of them are working. Why is it stuck in frame, have no clue at all 
Neo