8aa038bb2a349fbaded354ad1709ef1ca5811d1a
[potlatch2.git] / net / systemeD / halcyon / DebugURLRequest.as
1 package net.systemeD.halcyon {
2
3         /*
4                 === DebugURLRequest ===
5
6                 If nocache has been set to 'true' via FlashVars, this will make the URLRequest using 
7                 POST 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                 We use an evil Global because we don't know where loaderInfo.parameters will be.
14
15         */
16
17         import flash.net.URLRequest;
18         import flash.net.URLRequestMethod;
19         import flash.system.Capabilities;
20         import net.systemeD.halcyon.Globals;
21
22         public class DebugURLRequest {
23
24                 public var request:URLRequest;
25
26                 public function DebugURLRequest(url:String=null) {
27                         request=new URLRequest(url);
28                         if (Globals.vars.hasOwnProperty('nocache') && Globals.vars.nocache) {
29                                 request.method=URLRequestMethod.POST;
30                                 request.data=true;
31                         }
32                 }
33
34         }
35
36 }