File tree 3 files changed +20
-8
lines changed
3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 30
30
import mx.collections.ArrayCollection;
31
31
import mx.managers.PopUpManager;
32
32
33
+ /** Sets the currently selected item by consulting Imagery.instance() */
34
+ public function updateSelectedIndex() {
35
+ if(background.selectedIndex==-1) {
36
+ var im:Imagery = Imagery.instance();
37
+ var i = im.collection.indexOf(im.findBackgroundWithName(im.selected.name));
38
+ background.selectedIndex = i;
39
+ }
40
+ }
41
+
33
42
public function setDimming(v:Boolean):void {
34
43
Application.application.theMap.setDimming(dim.selected);
35
44
Application.application.yahoo.alpha = dim.selected ? 0.5 : 1;
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ package net.systemeD.potlatch2.collections {
10
10
import net.systemeD.potlatch2.FunctionKeyManager ;
11
11
import net.systemeD.potlatch2.Yahoo ;
12
12
import mx.collections.ArrayCollection ;
13
-
14
- /*
15
- There's lots of further tidying we can do:
16
- - remove all the horrid Yahoo stuff
17
- - remove the backreferences to _map and send events instead
18
- but this will do for now and help remove the clutter from potlatch2.mxml.
13
+
14
+ /** Manages the different choices of background imagery, dealing with details like retrieving lists of imagery,
15
+ * saving and retrieving the current choice, etc.
16
+ *
17
+ * TODO There's lots of further tidying we can do:
18
+ * - remove all the horrid Yahoo stuff
19
+ * - remove the backreferences to _map and send events instead
20
+ * but this will do for now and help remove the clutter from potlatch2.mxml.
19
21
*/
20
22
21
23
public class Imagery extends EventDispatcher {
@@ -172,7 +174,7 @@ package net.systemeD.potlatch2.collections {
172
174
obj . flush ();
173
175
}
174
176
175
- private function findBackgroundWithName (name :String ):Object {
177
+ public function findBackgroundWithName (name :String ):Object {
176
178
for each (var bg: Object in collection) {
177
179
if (bg. name == name ) { return bg; }
178
180
}
Original file line number Diff line number Diff line change 29
29
30
30
<mx : ApplicationControlBar dock =" true" >
31
31
<mx : PopUpButton id =" bgButton" label =" Background" openAlways =" true" styleName =" appBarButton"
32
- creationComplete =" bgButton.popUp = new BackgroundSelector();" />
32
+ creationComplete =" bgButton.popUp = new BackgroundSelector();"
33
+ open =" (bgButton.popUp as BackgroundSelector).updateSelectedIndex();" />
33
34
<mx : PopUpButton id =" styleButton" label =" Map Style" openAlways =" true" styleName =" appBarButton"
34
35
creationComplete =" styleButton.popUp = new StyleSelector();" />
35
36
<mx : PopUpMenuButton id =" gpsButton" styleName =" appBarButton"
You can’t perform that action at this time.
0 commit comments