PDA

View Full Version : Problem regarding LoadVars


deadlydentures
05-28-2003, 07:16 PM
Hi. I just starting learning flash two days ago so I'm sure there is something simple wrong with this action script i wrote.

status = "Logging in" ;
f_login = new LoadVars() ;
f_login.load("login.php?username=Clinton") ;
f_login.onLoad(success)
{
if( success )
{
status="yea" ;
}
else {
status="NOOOOO!!!" ;
}
}

When i test the movie, the status is at "NOOOOO!!!" and an error box appears and says
Error opening URL "file:///C|/board/login.php?username=Clinton"

I have apache 1.3 and php 4.3
both my flash movie and the login file reside in the same directory located at http://localhost/board/

My best guess is that Flash doesn't realize its on a server, and therefore, the php code isn't being ran. Why the funky file crap i don't know either. But if this is the case, than how would i go about changing that?

If its not the case, what is wrong with what i have?

Thank you in advance :D
[EDIT]
well, i just tried it with just "code.txt" which contains "&test=1&" and it still doesn't work. Doesn't display an error though.

freddycodes
05-28-2003, 08:14 PM
Couple of things. I assume you are testing the movie from within flash, if so you'll need to specify the full path like you thought.


loginurl = "http://localhost/board/login.php";
status = "Logging in" ;
f_login = new LoadVars() ;
f_login.load(loginurl+"?username=Clinton") ;
f_login.onLoad(success)
{
if( success )
{
status="yea" ;
}
else {
status="NOOOOO!!!" ;
}
}



Also what does the PHP code look like?

deadlydentures
05-28-2003, 08:30 PM
<?
import_request_variables('g', 'g_') ;

require('connect.php') ;

if (!$connect)
{
die ("&connect=0&") ;
}

require('checkpass.php') ;

if (!$checkpass)
{
die ("&checkpass=0&") ;
}

print "&login=1&" ;

?>
That doesn't say much at all, but when ran in the browser window it works perfectly, printings "&login=1&"
Full url doesn't work either.

freddycodes
05-28-2003, 08:48 PM
Doh! You have a syntax problem


f_login.onLoad(success)


Should be

f_login.onLoad = function(success)

deadlydentures
05-28-2003, 09:00 PM
It works!!
Sweet!
thanks man