theMap.updateSize(stage.stageWidth, stage.stageHeight);
addChild(theMap);
Globals.vars.root=theMap;
+ Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';
// add debug field
var t:TextField=new TextField();
/*
=== DebugURLRequest ===
- If this is running under a Flash debug player, this will make the URLRequest using POST
- rather than GET - thereby preventing FP from caching it
+ If nocache has been set to 'true' via FlashVars, this will make the URLRequest using
+ POST rather than GET - thereby preventing FP from caching it
(see http://www.ultrashock.com/forums/actionscript/force-reload-files-only-using-as3-123408.html).
Sadly we can't just subclass URLRequest, which is defined as final. So you need to create your
new DebugURLRequest, then refer to its .request property.
+
+ We use an evil Global because we don't know where loaderInfo.parameters will be.
*/
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.system.Capabilities;
+ import net.systemeD.halcyon.Globals;
public class DebugURLRequest {
public function DebugURLRequest(url:String=null) {
request=new URLRequest(url);
- if (Capabilities.isDebugger) {
+ if (Globals.vars.hasOwnProperty('nocache') && Globals.vars.nocache) {
request.method=URLRequestMethod.POST;
request.data=true;
}
// Miscellaneous events
public function keyUpHandler(event:KeyboardEvent):void {
- if ( !event.ctrlKey ) return;
addDebug("pressed "+event.keyCode);
- if (event.keyCode==73) { zoomIn(); } // I - zoom in
- if (event.keyCode==79) { zoomOut(); } // O - zoom out
- if (event.keyCode==76) { reportPosition(); } // L - report lat/long
+ if (event.keyCode==33) { zoomIn(); } // Page Up - zoom in
+ if (event.keyCode==34) { zoomOut(); } // Page Down - zoom out
+// if (event.keyCode==76) { reportPosition(); } // L - report lat/long
}
public function connectionError(err:Object=null): void {
if ( paint && paint.isBackground ) {
if ( event.type == MouseEvent.MOUSE_DOWN && ((event.shiftKey && event.ctrlKey) || event.altKey) ) {
- // pull data out of vector background layer
+ // alt-click to pull data out of vector background layer
var newEntity:Entity=paint.findSource().pullThrough(entity,controller.connection);
if (entity is Way) { return new SelectedWay(newEntity as Way); }
else if (entity is Node) { return new SelectedPOINode(newEntity as Node); }
- }
- return (this is NoSelection) ? this : new NoSelection();
+ } else if ( event.type == MouseEvent.MOUSE_UP ) {
+ return (this is NoSelection) ? null : new NoSelection();
+ } else { return null; }
}
if ( event.type == MouseEvent.MOUSE_DOWN ) {
// drag map
return new DragBackground(event);
}
- } else if ( event.type == MouseEvent.MOUSE_UP && focus == null && map.dragstate!=map.DRAGGING ) {
- return new NoSelection();
+ } else if ( event.type == MouseEvent.MOUSE_UP && focus == null && map.dragstate!=map.DRAGGING) {
+ return (this is NoSelection) ? null : new NoSelection();
} else if ( event.type == MouseEvent.ROLL_OVER ) {
controller.map.setHighlight(focus, { hover: true });
} else if ( event.type == MouseEvent.MOUSE_OUT ) {
}
override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
+ var cs:ControllerState = sharedMouseEvents(event, entity);
+ if (cs) return cs;
+
+ var paint:MapPaint = getMapPaint(DisplayObject(event.target));
var focus:Entity = getTopLevelFocusEntity(entity);
- if (event.type==MouseEvent.MOUSE_UP && focus==null && map.dragstate!=map.DRAGGING) {
+ if (event.type==MouseEvent.MOUSE_UP && (focus==null || (paint && paint.isBackground)) && map.dragstate!=map.DRAGGING) {
map.dragstate=map.NOT_DRAGGING;
var undo:CompositeUndoableAction = new BeginWayAction();
var startNode:Node = controller.connection.createNode(
MainUndoStack.getGlobalStack().addAction(undo);
return new DrawWay(way, true, false);
}
- var cs:ControllerState = sharedMouseEvents(event, entity);
- return cs ? cs : this;
+ return this;
}
override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
Globals.vars.map_area = map_area;
Globals.vars.root = map_area.rawChildren; // set up global reference to root level
var _root:IChildList = map_area.rawChildren; // convenient local shorthand
+ Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';
// populate sharedObject with loaderInfo parameters if supplied
var obj:SharedObject = SharedObject.getLocal("user_state");