load imagery from XML file
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox
3         xmlns:mx="http://www.adobe.com/2006/mxml"
4         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
5         horizontalAlign="left" backgroundColor="white" borderStyle="inset">
6         
7         <mx:List width="100%" height="100%" id="background" change="updateBackground();" verticalScrollPolicy="on" 
8                  dataProvider="{_layers}" />
9         <mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
10             change="Globals.vars.root.tileset.setDimming(dim.selected); Globals.vars.yahoo.alpha = dim.selected ? 0.5 : 1" />
11
12         <mx:Button label="Load vector file..." click="new VectorSourceDialog().init();"/>
13
14         <mx:Script><![CDATA[
15                 import net.systemeD.halcyon.*;
16                 import net.systemeD.halcyon.connection.*;
17                 import net.systemeD.potlatch2.*;
18                 import mx.core.*;
19                 import mx.collections.ArrayCollection;
20                 import mx.managers.PopUpManager;
21                 import net.systemeD.halcyon.Globals;
22
23                 [Bindable] private var _layers:Array=new Array(
24                         { label: "None", data: "" },
25                         { label: "Yahoo", data: "yahoo" } );
26
27                 public function populate(xml:XML):void {
28             for each(var set:XML in xml.set) {
29                 _layers.push({ label:set.child("name"), data:set.child("url") });
30             }           
31                 }
32
33                 private function updateBackground():void {
34             var theMap:Map = Globals.vars.root;
35                         var bg:String=background.selectedItem.data;
36                         if (bg=='yahoo') {
37                                 theMap.tileset.init('',false);
38                                 Globals.vars.yahoo.show();
39                         } else {
40                                 theMap.tileset.init(background.selectedItem.data,true);
41                                 Globals.vars.yahoo.hide();
42                         }
43                 }
44
45     ]]></mx:Script>     
46 </mx:VBox>
47