• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 730
  • Last Modified:

AS 3 my URLLoader returns the value 0 as HTTPStatusEvent.HTTP_STATUS other times works fine

I have a log-in a flash Movie. The flash Movie corresponds with the Server via URLLoader that calls a php page. When I run it locally it works fine, when I run it from the server it works in some browsers and other only sometimes or never.When it doesn;t work my HTTPStatusEventListener returns 0 as event.status. I do not get an IOError or a Security Error. I am at a loss. Here is my Code:

var logInRequest:URLRequest;
var logInLoader:URLLoader;
var URLSheet:AofF_URLCentral = new AofF_URLCentral;
var famousVet:URLVariables = new URLVariables();


function REGISTER(e:MouseEvent):void{
	famousVet.evFirstName = logInUI.firstName.textBox.text;
	famousVet.evLastName = logInUI.lastName.textBox.text;
	famousVet.evEmail = logInUI.eMail.textBox1.text + "@" + logInUI.eMail.textBox2.text;		
	
	
	logInRequest = new URLRequest(URLSheet.getUserIDURL)
	logInRequest.method=URLRequestMethod.POST;
	logInRequest.data =famousVet;


	logInLoader = new URLLoader()
	configureListeners(logInLoader);
	
	try{
		logInLoader.load(logInRequest);
	}
	catch (e:Error){
		if(tlTracking == true){
			timeLTracker.textBox.appendText("Error detected" + e.toString());
			
		}//end of IF
	}
}//end of Funtion REGISTER

function configureListeners(dispatcher:IEventDispatcher):void {
	dispatcher.addEventListener(Event.COMPLETE,CompleteHandlerID);
	dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorHandler);
	dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS,httpStatusHandler);
	dispatcher.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
}//end of configure Listener

function CompleteHandlerID(event:Event):void {
	yaddiyaddiyadda		
}// end of function CompleteHandlerID

function securityErrorHandler(event:SecurityErrorEvent):void {
	if (tlTracking == true){
		timeLTracker.textBox.appendText("\nErrorCode :  166 / Flash ErrorMsg:" + error.toString());					
	}	
}//end of privat function securityErrorHandler

function httpStatusHandler(e:HTTPStatusEvent):void {	
	if (tlTracking == true){		
		timeLTracker.textBox.appendText("\nHTTPSTatus:" + e.status );//this is where it returns 0
	}//end of IF				
}//end of hhtpStatusHandler

function ioErrorHandler(event:IOErrorEvent):void {
	trace("ioErrorHandler: " + event );				
	if (tlTracking == true){
		timeLTracker.textBox.appendText("Ein Fehler ist aufgetreten. \n\nErrorCode: 178");
	}//end of IF
}//end of ioErrorHandler

Open in new window

0
sketchbookshark
Asked:
sketchbookshark
  • 3
  • 2
1 Solution
 
dgofmanCommented:
You have to wait status code 200

http://wiki.openstreetmap.org/wiki/HTTP_Protocol_Specification#StatusCodeType

Zero error code indicates that the response was empty, (as not even headers were returned). This means the connection was accepted and then closed gracefully (TCP FIN). There are a number of things which could cause this, but based off of your description, some form of firewall seems the most likely culprit.
0
 
sketchbooksharkAuthor Commented:
Thanks dgofman,
I had been searching for an interpretation of that HTTPStatusEvent.status. This is very well explained.

In the meantime I have more information. I installed firebug and it turns out i get a 404 because flash is looking for the crossdomain.XML, which I didn't write, because it's in the same Domain. Could it be that I should not have "http://" in the URL for it to recognize the URL as sameDomain?

If I do have to create a crossdomain.xml, where should that be saved?
0
 
dgofmanCommented:
Your crosssdomain.xml file should be on remote host not on local.
You have to create this file and upload to webhost root directory

Try to access to this file via browser

http://remotehost.com/crossdomain.xml
0
 
sketchbooksharkAuthor Commented:
OK. the problem is fixed.

Thank you very much for your help in explaining the Status Event. That's what got me on the right trail.

Since I did not have privileges to place anything in the root of the domain, the crossdomain.xml was not a possible solution.

 What did fix the problem was a relative path in my URL, which eliminated the "http://www". Once that was gone the whole thing worked like a charm. So I am now going one level up and then into the php folder:

 
var URL:String"../php/my_php_page.php"

Open in new window

0
 
dgofmanCommented:
Thanks sketchbookshark,
I will glad if you will provide some points for my time :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now