Load turn restriction images from FileBank
authorRichard Fairhurst <richard@systemeD.net>
Tue, 3 Jul 2012 11:29:40 +0000 (12:29 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Tue, 3 Jul 2012 11:29:40 +0000 (12:29 +0100)
net/systemeD/potlatch2/mapfeatures/editors/TurnRestrictionRenderer.mxml

index 7687a26..4383caa 100644 (file)
@@ -6,11 +6,19 @@
        width="40" height="40" maxWidth="40" maxHeight="40" minWidth="40" minHeight="40"
        mouseEnabled="false" mouseChildren="false">
 
-       <mx:Image x="0" y="0" id="sign" left="4" top="4" source="{dataProxied.data ? 'features/restriction__'+dataProxied.data+'.png' : ''}" toolTip="{dataProxied.label}" />
+       <mx:Image x="0" y="0" id="sign" left="4" top="4" source="{iconSource()}" toolTip="{dataProxied.label}" />
 
   <fx:Script><![CDATA[
 
        import mx.utils.ObjectProxy;
+    import net.systemeD.halcyon.FileBank;
+
+       [Bindable(event="dataChange")] public function iconSource():* {
+               var d:String=dataProxied.data; if (!d) return '';
+               var fn:String="features/restriction__"+d+".png";
+               var fb:FileBank=FileBank.getInstance();
+               return fb.hasFile(fn) ? fb.getAsByteArray(fn) : fn;
+       }
 
        [Bindable(event="dataChange")] public function get dataProxied():ObjectProxy {
                return new ObjectProxy(data);