public function closeBug(m:Marker):void {
var id:String = m.getTag('bug_id');
var status:String = BUG_STATUS_FIXED;
- var comment:String = "no comment";
+ var comment:String = "NoComment";
var nickname:String = "NoName";
- //TODO make this a post request
+ //TODO urlencode stuff
+ var urlReq:URLRequest = new URLRequest(baseUrl+"changeBugStatus?id="+id+"&status="+status+"&comment="+comment+"&nickname="+nickname+"&key="+apiKey);
+ urlReq.method = "POST";
+ urlReq.data = ' '; // dear Adobe, this is nuts, kthxbye (you can't POST with an empty payload)
var loader:URLLoader = new URLLoader();
- loader.load(new URLRequest(baseUrl+"changeBugStatus?&id="+id+"&status="+status+"&comment="+comment+"&nickname="+nickname+"&key="+apiKey));
+ loader.load(urlReq);
loader.addEventListener(Event.COMPLETE, bugClosed);
}
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
<mx:Text id="markerPanelText" text="You have selected a marker." width="100%" styleName="helpInfo" />
- <mx:DataGrid editable="false" id="markerPanelDG" width="100%" height="100%">
+ <mx:DataGrid editable="false" id="markerPanelDG" width="100%" height="50%">
<mx:columns>
<mx:DataGridColumn editable="false" dataField="key" headerText="key" />
<mx:DataGridColumn editable="false" dataField="value" headerText="value" />
import flash.net.*;
import flash.events.*;
import com.adobe.serialization.json.JSON;
+ import flash.system.Security;
public class BugLoader {
this.map = map;
this.bugBaseURL = url;
this.bugApiKey = bugApiKey;
+ var policyFile:String = bugBaseURL+"crossdomain.xml";
+ Security.loadPolicyFile(policyFile);
}
public function load():void {
var loader:URLLoader = new URLLoader();
- loader.load(new URLRequest(bugBaseURL+"getBugs.json?bbox="+map.edge_l+","+map.edge_b+","+map.edge_r+","+map.edge_t+"&key="+bugApiKey));
+ loader.load(new URLRequest(bugBaseURL+"getBugs?bbox="+map.edge_l+","+map.edge_b+","+map.edge_r+","+map.edge_t+"&key="+bugApiKey));
+ loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, balls);
loader.addEventListener(Event.COMPLETE, parseJSON);
}
+ public function balls(event:SecurityErrorEvent):void {
+ trace(event);
+ }
+
private function parseJSON(event:Event):void {
var result:String = String(event.target.data);
var featureCollection:Object = JSON.decode(result);