Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2005, 05:24 PM
Authorized User
 
Join Date: May 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default flash and PHP.. somebody please help

Hi,

After getting to grips with programming in php,mysql and combining it with html, i am now having a little difficulty in grasping, how flash works with php.. I have followed many tutorials and books, but still i cannot understand how php send data back to flash


Here is my code:
in flash

_root.loggedIn=false;



sym.onEnterFrame=function()
{
_root.LoginApplication.Login.submit.onPress = function()
{


//connect to database
var ab = new LoadVars ();
ab.username = this._parent.username.text;
ab.pass = this._parent.pass.text;
ab.onLoad= validate;
ab.sendAndLoad ('http://www.jsten.com/flash_login.php', ab, "POST");


function validate()
{

if(this.output=='success')
{
trace("success");
sym._alpha=0;
}

if (this.output=="fail")
{
sym._alpha=0;
}


}
}
}



and simply in the flash_login.php file is one line for now:

echo("output=success");

From what i understand, the flash file should simply access this php file on submit button press, and then the 'output=success' returned, whereby flash then prints a trace to the screen, for my benefit, to say that it has worked.

Except it doesnt.....

Please can someone explain what im doing wrong

Thanks
Steve
 
Old May 20th, 2005, 09:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Steve
If you go to the Flash help and search in actionscript dicitionary sendandload there at the bottom it tells you where a sample is of login.fla the only difference is they are sending to a coldfusion file.

Here is a tutorial that explains using the sendandload and how to send back the php content
http://actionscript-toolbox.com/samplemx_loadvars.php

These 2 samples can explain it a lot better and in more detail than I could. If you have any questions on these let me know.






Peace
Mike
http://www.eclecticpixel.com
http://www.homegrownmusicjam.com
 
Old May 20th, 2005, 05:21 PM
Authorized User
 
Join Date: May 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thanks for the reply.

I figured out what it was and it doesnt really make any sense. My domain is registered as jsten.co.uk, but i have also jsten.com which directs to it.

You will notice in the url, that i am using jsten.com.... and this is what caused the problem. I changed it to jsten.co.uk, and now i can access the php fine.

This must be some kind of bug...i will contact my host on Monday, to ask why using com would be causing a problem

Thanks
Steve






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to modify flash so it pulls php url every 15 s method Flash (all versions) 4 February 27th, 2007 06:19 PM
PHP Flash communicatie Dj Kat Flash (all versions) 2 May 18th, 2006 04:18 AM
PHP Mysql with Flash based display robprell Beginning PHP 0 November 3rd, 2005 10:06 PM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
PHP varibles in FLASH Ashleek007 Beginning PHP 1 November 30th, 2004 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.