all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

Works in Flash but not on Web ???


Works in Flash but not on Web ??? Mark Kellie
10/31/2005 11:45:50 PM
flash actionscript:
Help !!!

I have form using the actionscript attached to this topic.
The form functions correctly inside of Flash but when it is uploaded and run
in a browser it doesnt work.
The form connects to my database to deposit the information and then the php
page returns OK if it was successful and nothing if it is not. Inside of flash
the data populates the database and an OK result is posted. When played in the
browser it returns "undefined". I think I have checked everything and I am now
very baffled by this?

Any help would be most welcome...

var oListener:Object = new Object();
oListener.click = function(oEvent:Object):Void
{
// convert form fields to names
var chkEmail = contactEmail.text;
var chkContactName = contactName.text;
var chkCompanyName = contactCompany.text;
var chkTelephone = contactTelephone.text;
var chkTitlePosition = contactTitlePosition.text;
var chkEnquiry = contactEnquiry.text;
var chkOtherInfo = contactOtherInfo.text;

// START - check e-mail is valid ----------------------------
/* // var reEmail:RegExp = new
RegExp("^([\\w]+\\.)*?[\\w]+@[\\w]+\\.([\\w]+\\.)*?[\\w]+$");
var reEmail:RegExp = new
RegExp("^([_a-zA-Z0-9.]*[-]*)*@(([a-zA-Z0-9]+[-]*)+\\.)+[a-zA-Z]{2,4}$");
if(!reEmail.test(chkEmail))
{
mx.controls.Alert.show("Please enter a valid email address.", "Caution");
var email_valid = "NO";
}
else
{
var email_valid = "YES";
}
// END - check e-mail is valid ------------------------------ */

var email_valid = "YES";

// START - check fields are completed ----------------------------
if (chkContactName && chkCompanyName && chkTelephone && chkEnquiry)
{
var fields_valid = "YES";
}
else
{
var fields_valid = "NO";

}
// END - check fields are completed-------------------------------

if (email_valid == "YES" && fields_valid == "YES")
{
// prepare for submitting
var lvSender:LoadVars = new LoadVars();
var lvReciept:LoadVars = new LoadVars();

// load in variables to send
lvSender.email = chkEmail;
lvSender.contactname = chkContactName;
lvSender.companyname = chkCompanyName;
lvSender.titleposition = chkCompanyName;
lvSender.telephone = chkTelephone;
lvSender.enquiry = chkEnquiry;
lvSender.clientID = "jer0410";
lvSender.formID = "3";
lvSender.responsetype = "FLASH";

//trace("email: " + lvSender.email);

email.text = lvSender.email;




// send to php script

lvSender.sendAndLoad("http://www.carbonfour.co.uk/emailsystem/central_email.ph
p", lvReciept);


lvReciept.onLoad = function():Void{
success.text = lvReciept.success;
//trace("success: " + lvReciept.success);

/*
if (lvReciept.success == "OK")
{
gotoAndPlay("success");
}
else
{
gotoAndPlay("fail");
}
*/

}
}
else
{
mx.controls.Alert.show("Please ensure all fields are filled in.", "Caution");
}

};
formSubmit.label = "Submit Form";
formSubmit.addEventListener("click", oListener);

stop();
Re: Works in Flash but not on Web ??? Grand Junction
11/1/2005 11:42:10 AM
Which php version and server did you use to test? Meaning it could be a security issue. Php now requires posted variables to be declared. An example of the php might help.
Re: Works in Flash but not on Web ??? Mark Kellie
11/1/2005 12:24:36 PM
Hi Grand Junction

PHP Version is 4.3.10 & Server is Apache 1.3.33

How would running it in flash bypass that security & populate the database,
yet running the sites swf in a browser prevent it ?

Do you still need the php doc?

all very confusing ! Cheers
Re: Works in Flash but not on Web ??? Grand Junction
11/1/2005 1:10:06 PM
K.. since I saw target url:
"http://www.carbonfour.co.uk/emailsystem/central_email.php" I wondered. Is that
server yours or a provider server? did you debug local and then uploaded the
script and swf ?
If you uploaded to a provider I hope you thought about setting the database
handle: pass and user.. since the script seems to return nothing it may be that
the database can not be opened. You can test by calling the script in your
browser with the parameters through GET
I got message "Sorry, this form is not configured correctly. Please contact
support on 08707 777 090" I hope that was intended.

In case you debugged with an uploaded script (absolute path), I agree it
should work when you upload the swf there ( although I always call my urls
relative on server maybe try that flash has a security issue with crossdomain )
Btw are you sure you don't run a cached version of the movie in your browser?
That prooved to be a nuisance to me many a time when debugging.. try opening
the swf file direct in your browser..

hope this helps a little
greetz Martijn



AddThis Social Bookmark Button