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

Posted on 2011-05-13
Last Modified: 2013-12-12
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; =famousVet;

	logInLoader = new URLLoader()
	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 {
}//end of configure Listener

function CompleteHandlerID(event:Event):void {
}// 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

Question by:sketchbookshark
    LVL 29

    Accepted Solution

    You have to wait status code 200

    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.
    LVL 1

    Author Comment

    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?
    LVL 29

    Expert Comment

    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
    LVL 1

    Author Comment

    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

    LVL 29

    Expert Comment

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

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now