Flash Header won’t work!

By mtataric | Jul 10, 2009

actionscript3

Hi,

I have been watching all the youtube videos on how to create a community website(webintersect). I can not get my flash header to work though. I read and did everything exactly as Adam showed. Even when I try to use his header by changing for ex: www.yourwebsite.com/scripts/checkuserlog to my "jshladha" website it gives me the following error:

TypeError: Error #2007: Parameter text must be non-null.

at flash.text::TextField/set text()

at header_fla::MainTimeline/completeHandler1()

at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()

at flash.events::EventDispatcher/dispatchEvent()

at flash.net::URLLoader/flash.net:URLLoader::onComplete()

I kinda narrowed it down to "welcome_txt.text=event.target.data.member_nam e;"

there is a problem but I can’t figure it out..

Any ideas why? I guess I am the only person having this problem according to a google search..

here is my codes:

stop();
// Assign a variable name for our URLVariables object
var vars:URLVariables = new URLVariables();

// Build the varSend variable
var varSend1:URLRequest = new URLRequest("http://www.mywebsite.com/scripts/checkuserlog.php");
varSend1.method = URLRequestMethod.POST;
varSend1.data = vars;

// Build the varLoader variable
var varLoader1:URLLoader = new URLLoader;
varLoader1.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader1.addEventListener(Event.COMPLETE, completeHandler1);

// Handler for PHP script completion and return
function completeHandler1(event:Event):void{

if (event.target.data.return_msg == "not_logged_in") {

gotoAndStop(2);

} else {

welcome_txt.text = event.target.data.member_name;
gotoAndStop(3);

}

}

vars.post_code = "check_log";
varLoader1.load(varSend1);

PHP CODE:

<?php
session_start();
// Created BY Adam Khoury @ www.developphp.com
if ($_POST['post_code'] == "check_log") {

if (!isset($_SESSION['id'])) {

if (!isset($_COOKIE['idCookie'])) {

print "return_msg=not_logged_in";
exit();

}

}

// connect to DB to update last visit day
include_once "connect_to_mysql.php";

// If session ID is set for logged in user
// The regular session expires by default every time the user closes their browser down
// If that is the case this section will not run and the section below for recognizing set cookies will run
if (isset($_SESSION['id'])) {

$id = $_SESSION['id'];
$firstname = $_SESSION['firstname'];
print "id=$id&member_name=$firstname";

exit();

}

// If cookies are set, but no session ID is set yet, we set it below and update the last_log_date field in database
if (isset($_COOKIE['idCookie'])) {

$id = $_COOKIE['idCookie'];
$firstname = $_COOKIE['firstnameCookie'];
$email = $_COOKIE['emailCookie'];
$pass = $_COOKIE['passCookie'];
// Register the session vars just like we do in the login form
session_register(’id’);
$_SESSION['id'] = $id;
session_register(’firstname’);
$_SESSION['firstname'] = $firstname;
session_register(’email’);
$_SESSION['email'] = $email;
session_register(’pass’);
$_SESSION['pass'] = $pass;
// Access the value of these two session variables for use in sql statement below
// and also for sending these two vars into the flash header for use and display
$id = $_SESSION['id'];
$firstname = $_SESSION['firstname'];

/////////// Update Last Log Date Field Or not /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Check last visit date does not equal today
$sql1 = mysql_query("SELECT last_log_date FROM myMembers WHERE id=’$id’");
while($row = mysql_fetch_array($sql1)){
$last_log_date = $row["last_log_date"];
}
// This sets today’s date format that will be matching that of the var below coming from mysql
$today = date("Y-m-d");
// this makes the date the same format as the today date var format for easy comparison of the two
$last_log_date = strftime("%Y-%m-%d", strtotime($last_log_date));
if ($last_log_date != $today) {
mysql_query("UPDATE myMembers SET last_log_date=now() WHERE id=’$id’");
}
/////////// END Update Last Log Date Field Or not ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Print to flash
print "id=$id&member_name=$firstname";

exit();

} // close the if (isset($_COOKIE['firstnameCookie'] section

} // close first if statement - $_POST['post_code'] == "check_log"
?>

<?php
// ************************ This is the original check user log script WITHOUT the REMEMBER ME feature, for you to reference ****************************
/*
session_start();

if ($_POST['post_code'] == "check_log") {

if (!isset($_SESSION['id'])) {

print "return_msg=not_logged_in";

} else {

$id = $_SESSION['id'];
$firstname = $_SESSION['firstname'];
print "member_id=$id&member_name=$firstname";

exit();

}

} // close first if statement
*/
?>

ANY HELP WOULD BE APPRECIATED !

~Kaan

:confused:

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0