it's the end of the world as we know it
[potlatch2.git] / halcyon.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:Application 
3         xmlns:mx="http://www.adobe.com/2006/mxml" 
4         xmlns:halcyon="net.systemeD.halcyon.*"
5         layout="vertical"
6         horizontalAlign="center" 
7         addedToStage="initApp()">
8
9 <!--    <halcyon:CountryComboBox /> -->
10
11 <!--    <halcyon:Map width="400" height="200" id="theMap" /> -->
12 <!-- applicationComplete -->
13 <!-- rawChildren -->
14
15         <mx:Script><![CDATA[
16                 import net.systemeD.halcyon.*;
17                 import flash.system.Security;
18                 import flash.net.*;
19                 import flash.events.MouseEvent;
20                 import flash.display.Sprite;
21                 import mx.core.IChildList;
22
23                 private function initApp():void {
24
25                         Globals.vars.root=rawChildren;                  // set up global reference to root level
26                         var _root:IChildList=rawChildren;               // convenient local shorthand
27
28                         // map backdrop object
29                         var b:Sprite=new Sprite();
30                         b.graphics.beginFill(0xFFFFEA,100);
31                         b.graphics.drawRect(0,0,200,200);
32                         b.graphics.endFill();
33                         _root.addChild(b);
34
35                         // add map
36                         var theMap:Map=new Map();
37                         theMap.backdrop=b;
38                         _root.addChild(theMap);
39
40                         // add mask for map
41                         var s:Sprite=new Sprite();
42                         s.graphics.beginFill(0xFFFFFF,100);
43                         s.graphics.drawRect(0,0,200,200);
44                         s.graphics.endFill();
45                         _root.addChild(s);
46
47                         theMap.mask=s;
48
49                         // mouse-up handler attached to stage, so the user can release outside the map
50                         stage.addEventListener(MouseEvent.MOUSE_UP, theMap.mouseUpHandler);
51                         theMap.backdrop.addEventListener(MouseEvent.MOUSE_MOVE, theMap.mouseMoveHandler);
52                         theMap.backdrop.addEventListener(MouseEvent.MOUSE_DOWN, theMap.mouseDownHandler);
53
54                         // keyboard event attached to stage
55                         stage.addEventListener(KeyboardEvent.KEY_UP, theMap.keyUpHandler);
56
57                         // add debug field
58                         var t:TextField=new TextField();
59                         t.width=400; t.height=100; t.border=true; 
60                         t.multiline=true;
61                         _root.addChild(t);
62                         Globals.vars.debug=t;
63                 }
64
65         ]]></mx:Script>
66
67 </mx:Application>
68