
{"id":37,"date":"2006-06-14T13:55:25","date_gmt":"2006-06-14T12:55:25","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=37"},"modified":"2006-06-17T13:56:36","modified_gmt":"2006-06-17T12:56:36","slug":"rtfm-onhttpstatus","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2006\/06\/14\/rtfm-onhttpstatus\/","title":{"rendered":"RTFM: onHTTPStatus"},"content":{"rendered":"<p>For some time I wanted to create better feedback (error or alert) when you use cross-domain data (XML, TXT, JPG, FLV, etc.).<br \/>\nThe more experienced flash programmer know that this you need a <a href=\"http:\/\/livedocs.macromedia.com\/flash\/8\/main\/00001621.html\">crossdomain.xml<\/a>.<\/p>\n<p>But flash never gives you any feedback if you need the crossdomain.xml of is it&#8217;s there or not. So you need <a href=\"http:\/\/www.fiddlertool.com\/fiddler\/\">Fiddler <\/a>, <a href=\"http:\/\/www.xk72.com\/charles\/\">Charles<\/a> or some other http debugger to debug.<\/p>\n<p>In the helpfiles of Flash I found the documentation about <a href=\"http:\/\/livedocs.macromedia.com\/flash\/8\/main\/00002875.html\">onHTTPStatus<\/a> and more information about <a href=\"ftp:\/\/ftp.isi.edu\/in-notes\/rfc2616.txt\">HTTP specification<\/a> and after a quick scan of the information there I decided this is what I needed.<\/p>\n<p>I wrote a class that would give me feedback&#8230;&#8230;.. and all I got back was a 0 (zero) in Firefox and 404 using IE. Thats a strange bug&#8230;. so I started to read the helpfiles a little beter and found this:<\/p>\n<blockquote><p>A value of 0 can be generated in any player, such as if a malformed URL is requested, and is always generated by the Flash Player plug-in when run in the following browsers, which do not pass HTTP status codes to the player: Netscape, Mozilla, Safari, Opera, or Internet Explorer for the Macintosh.<\/p><\/blockquote>\n<p>So that killed the experiment immediately: I can&#8217;t have code that only work in IE.<\/p>\n<p><!--more--><\/p>\n<p>But if <strong>YOU<\/strong> need http feedback and you&#8217;re using only IE I have some code for you:<\/p>\n<pre>\r\nfunction temp(httpStatusType:Number):String {\r\n\tvar httpStatusTxt:String = \"\";\r\n\tswitch (httpStatusType) {\r\n\tcase 100 :\r\n\t\thttpStatusTxt = \"Continue\";\r\n\t\tbreak;\r\n\tcase 101 :\r\n\t\thttpStatusTxt = \"Switching Protocols\";\r\n\t\tbreak;\r\n\tcase 200 :\r\n\t\thttpStatusTxt = \"OK\";\r\n\t\tbreak;\r\n\tcase 201 :\r\n\t\thttpStatusTxt = \"Created\";\r\n\t\tbreak;\r\n\tcase 202 :\r\n\t\thttpStatusTxt = \"Accepted\";\r\n\t\tbreak;\r\n\tcase 203 :\r\n\t\thttpStatusTxt = \"Non-Authoritative Information\";\r\n\t\tbreak;\r\n\tcase 204 :\r\n\t\thttpStatusTxt = \"No Content\";\r\n\t\tbreak;\r\n\tcase 205 :\r\n\t\thttpStatusTxt = \"Reset Content\";\r\n\t\tbreak;\r\n\tcase 206 :\r\n\t\thttpStatusTxt = \"Partial Content\";\r\n\t\tbreak;\r\n\tcase 300 :\r\n\t\thttpStatusTxt = \"Multiple Choices\";\r\n\t\tbreak;\r\n\tcase 301 :\r\n\t\thttpStatusTxt = \"Moved Permanently\";\r\n\t\tbreak;\r\n\tcase 302 :\r\n\t\thttpStatusTxt = \"Found\";\r\n\t\tbreak;\r\n\tcase 303 :\r\n\t\thttpStatusTxt = \"See Other\";\r\n\t\tbreak;\r\n\tcase 304 :\r\n\t\thttpStatusTxt = \"Not Modified\";\r\n\t\tbreak;\r\n\tcase 305 :\r\n\t\thttpStatusTxt = \"Use Proxy\";\r\n\t\tbreak;\r\n\tcase 307 :\r\n\t\thttpStatusTxt = \"Temporary Redirect\";\r\n\t\tbreak;\r\n\tcase 400 :\r\n\t\thttpStatusTxt = \"Bad Request\";\r\n\t\tbreak;\r\n\tcase 401 :\r\n\t\thttpStatusTxt = \"Unauthorized\";\r\n\t\tbreak;\r\n\tcase 402 :\r\n\t\thttpStatusTxt = \"Payment Required\";\r\n\t\tbreak;\r\n\tcase 403 :\r\n\t\thttpStatusTxt = \"Forbidden\";\r\n\t\tbreak;\r\n\tcase 404 :\r\n\t\thttpStatusTxt = \"Not Found\";\r\n\t\tbreak;\r\n\tcase 405 :\r\n\t\thttpStatusTxt = \"Method Not Allowed\";\r\n\t\tbreak;\r\n\tcase 406 :\r\n\t\thttpStatusTxt = \"Not Acceptable\";\r\n\t\tbreak;\r\n\tcase 407 :\r\n\t\thttpStatusTxt = \"Proxy Authentication Required\";\r\n\t\tbreak;\r\n\tcase 408 :\r\n\t\thttpStatusTxt = \"Request Time-out\";\r\n\t\tbreak;\r\n\tcase 409 :\r\n\t\thttpStatusTxt = \"Conflict\";\r\n\t\tbreak;\r\n\tcase 410 :\r\n\t\thttpStatusTxt = \"Gone\";\r\n\t\tbreak;\r\n\tcase 411 :\r\n\t\thttpStatusTxt = \"Length Required\";\r\n\t\tbreak;\r\n\tcase 412 :\r\n\t\thttpStatusTxt = \"Precondition Failed\";\r\n\t\tbreak;\r\n\tcase 413 :\r\n\t\thttpStatusTxt = \"Request Entity Too Large\";\r\n\t\tbreak;\r\n\tcase 414 :\r\n\t\thttpStatusTxt = \"Request-URI Too Large\";\r\n\t\tbreak;\r\n\tcase 415 :\r\n\t\thttpStatusTxt = \"Unsupported Media Type\";\r\n\t\tbreak;\r\n\tcase 416 :\r\n\t\thttpStatusTxt = \"Requested range not satisfiable\";\r\n\t\tbreak;\r\n\tcase 417 :\r\n\t\thttpStatusTxt = \"Expectation Failed\";\r\n\t\tbreak;\r\n\tcase 500 :\r\n\t\thttpStatusTxt = \"Internal Server Error\";\r\n\t\tbreak;\r\n\tcase 501 :\r\n\t\thttpStatusTxt = \"Not Implemented\";\r\n\t\tbreak;\r\n\tcase 502 :\r\n\t\thttpStatusTxt = \"Bad Gateway\";\r\n\t\tbreak;\r\n\tcase 503 :\r\n\t\thttpStatusTxt = \"Service Unavailable\";\r\n\t\tbreak;\r\n\tcase 504 :\r\n\t\thttpStatusTxt = \"Gateway Time-out\";\r\n\t\tbreak;\r\n\tcase 505 :\r\n\t\thttpStatusTxt = \"HTTP Version not supported\";\r\n\t\tbreak;\r\n\tdefault :\r\n\t\thttpStatusTxt = \"Flash error\";\r\n\t\tbreak;\r\n\t}\r\n\treturn (httpStatusTxt);\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For some time I wanted to create better feedback (error or alert) when you use cross-domain data (XML, TXT, JPG, FLV, etc.). The more experienced flash programmer know that this you need a crossdomain.xml. But flash never gives you any feedback if you need the crossdomain.xml of is it&#8217;s there or not. So you need [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-flash"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}