disable caching when using Flash Debug Player
[potlatch2.git] / net / systemeD / halcyon / DebugURLRequest.as
1 package net.systemeD.halcyon {
2
3         /*
4                 === DebugURLRequest ===
5
6                 If this is running under a Flash debug player, this will make the URLRequest using POST 
7                 rather than GET - thereby preventing FP from caching it
8                 (see http://www.ultrashock.com/forums/actionscript/force-reload-files-only-using-as3-123408.html).
9                 
10                 Sadly we can't just subclass URLRequest, which is defined as final. So you need to create your 
11                 new DebugURLRequest, then refer to its .request property.
12
13         */
14
15         import flash.net.URLRequest;
16         import flash.net.URLRequestMethod;
17         import flash.system.Capabilities;
18
19         public class DebugURLRequest {
20
21                 public var request:URLRequest;
22
23                 public function DebugURLRequest(url:String=null) {
24                         request=new URLRequest(url);
25                         if (Capabilities.isDebugger) {
26                                 request.method=URLRequestMethod.POST;
27                                 request.data=true;
28                         }
29                 }
30
31         }
32
33 }