So i have this class , It get’s two values from an input text and sends the data to my login php where everything works fine . It is supposed to return 0 (bad login) , 1 (good login) .
package
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoaderDataFormat
import flash.net.URLRequestMethod
import flash.display.Stage;
public class LoginMenu
{
public Succes=0;
function LoginMenu()
{
}
public function VarifyLogin(username:String,pasword:String):String
{
var request:URLRequest=new URLRequest("login.php");
request.method=URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.username=username;
variables.pasword=pasword;
request.data=variables;
var loader:URLLoader=new URLLoader(request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.load(request)
function onComplete(event:Event):Number
{
Succes=event.target.data.verif
}
return Succes;
}
}
}
If i put the basic URLRequest on the timeline it works fine . I have no idea what is going wrong since i just started learning OOP type flash as3 .
Thank you :glasses: