Guestbook

Well I have finished the frame for my first website :slight_smile: but in trying to add php & MySQL is a little more difficult :frowning:

Request Entries

[AS]
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoader;
import flash.events.Event;
var variables_re:URLVariables = new URLVariables();
var varSend_re:URLRequest = new URLRequest(“guestbookParse.php”);
varSend_re.method = new URLRequestMethod.POST;
varSend_re.data = variables_re;
var varLoader_re:URLLoader = new URLLoader;
varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader_re.addEventListener(Event.COMPLETE,completeHandler_re);
function completeHandler_re(event:Event):void{
if(event.target.data.returnBody==""){
gbOutput_txt.text=“No data coming through.”
}else{
gbOutput_txt.condenseWhite = true;
gbOutput_txt.htmlText = “”+event.target.data.returnBody;
}
}
variables_re.comType = “requestEntries”;
varLoader_re.load(varSend_re);
[/AS]

Send Entry

[AS]
import flash.text.TextFormat;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.events.MouseEvent;
msg_txt.restrict = “A-Za-z 0-9”;
name_txt.restrict = “A-Za-z 0-9”;
location_txt.restrict = “A-Za-z 0-9”;
var errorsFormat:TextFormat = new TextFormat();
errorsFormat.color = 0xFF0000;
processing_mc.visible = false;
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest(“guestbookParse.php”);
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void{
processing_mc.visible = false;
name_txt.text = “”;
location_txt.text = “”;
msg_txt.text = “”;
status_txt.text = event.target.data.returnBody;
gbOutput_txt.condenseWhite = true;
gbOutput_txt.htmlText = “” + event.target.data.returnVody;
}
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
if(!name_txt.lenght){
status_txt.text = “Please enter your name.”;
status_txt.setTextFormat(errorsFormat);
} else if (!location_txt.lenght){
status_txt.text = “Please enter your location”;
status_txt.setTextFormat(errorsFormat);
} else if (!msg_txt.lenght){
status_txt.text = “Please enter a message.”;
status_txt.setTextFormat(errorsFormat);
} else {
processing_mc.visible = true;
variables.comType = “parseComment”;
variables.userName = name_txt.text;
variables.userLocation = location_txt.text;
variables.usrMsg = msg_txt.text;
varLoader.load(varSend);
status_txt.text = “Waiting for server connection…”;
}
}
[/AS]

hope someone can help :slight_smile:

error codes
Symbol ‘GUESTBOOK’, Layer ‘SEND.ENTRY.CODE’, Frame 1, Line 32 1119: Access of possibly undefined property lenght through a reference with static type flash.text:TextField.

I got php code as well if you want that … and yes I have set up the db on my webserver