Select to view content in your preferred language

adding footer to maps on 1.3 viewer

740
5
06-17-2011 05:09 AM
DanielLewis
Emerging Contributor
I looked at the source to the 2.3 copyright widget by Robert Scheitlin and tried to make something similar for the 1.3 viewer, here's the source, which isn't working:

<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Display footer on maps
//
////////////////////////////////////////////////////////////////////////////////
-->

<BaseWidget xmlns    ="com.esri.solutions.flexviewer.*" 
      xmlns:mx   ="http://www.adobe.com/2006/mxml"
      x     ="600" 
      y     ="220" 
      widgetConfigLoaded ="init()">
     
 <mx:Script>
  
  <![CDATA[
   import com.esri.ags.events.ExtentEvent;
  
   import mx.controls.Alert;
   
   import com.esri.ags.Map;
   
   
   private function init():void
   {
    map.addEventListener(ExtentEvent.EXTENT_CHANGE, repositionInfo);
    txtVersion.text = "footer text";
   }
   
   
   private function repositionInfo(event:Event):void
   { 
    txtVersion.text = "footer text";
   }
  ]]>
 </mx:Script>
  
<mx:Label id="txtVersion" alpha="1" />
 
</BaseWidget>


And I added the following to the config.xml:
<widget right="95" bottom="3" url="com/xyz/widgets/footer/footer.swf"/>

Any help is greatly appreciated.
Tags (2)
0 Kudos
5 Replies
DanielLewis
Emerging Contributor
I made some changes:
<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Display footer on maps
//
////////////////////////////////////////////////////////////////////////////////
-->

<BaseWidget xmlns    ="com.esri.solutions.flexviewer.*" 
      xmlns:mx   ="http://www.adobe.com/2006/mxml"
      x     ="600" 
      y     ="220" 
      widgetConfigLoaded ="init()" >
     
 <mx:Script>
  
  <![CDATA[
   import mx.messaging.channels.StreamingAMFChannel;
   import com.esri.ags.events.ExtentEvent;
   import mx.controls.Alert;
   import com.esri.ags.Map;
   import mx.controls.Alert;
   
   private function init():void
   {
    const color:String = "0x000000";
    txtVersion.setStyle("color", toNumber(color.length ? color : "0x000000"));
    const fontFamily:String = "Verdana";
    txtVersion.setStyle("fontFamily", fontFamily.length ? fontFamily : "Verdana");
    const fontSize:String = configXML.label.@fontsize;
    txtVersion.setStyle("fontSize", parseInt(fontSize.length ? fontSize : "9"));
    const fontWeight:String = configXML.label.@fontweight;
    txtVersion.setStyle("fontWeight", fontWeight.length ? fontWeight : "bold");


    txtVersion.text = "Footer Text";
   }
   

   
   private function toNumber(value:String):int
   {
    if (value.substr(0, 2) == "0x")
    {
     return parseInt(value, 16);
    }
    return parseInt(value, 10);
   }
   

   
  ]]>
 </mx:Script>

<mx:Label id="txtVersion" alpha="1"   text="Footer Text" enabled="true"/>
 
</BaseWidget>


Apologies to Robert for obliterating his code, but trying to learn.

This DOES display the text, but on the dock and it can't be undocked.  Perhaps I'm approaching this wrong and shouldn't do it as a widget?  Could a change be made to mapmanager (assuming that's the right place) to add a footer to the display below the map being displayed, or overlay the bottom of the map being displayed?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

  If you are wanting to add some static text to the bottom of the map then just add a mx label to the index.mxml.
0 Kudos
DanielLewis
Emerging Contributor
Daniel,

  If you are wanting to add some static text to the bottom of the map then just add a mx label to the index.mxml.


Thank you!  How do I make it so the label will "stick" to the bottom of the screen and move with the bottom edge as the user resizes the browser window?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   For that just set the bottom and right attributes to 0 or 5.
0 Kudos
DanielLewis
Emerging Contributor
Daniel,

   For that just set the bottom and right attributes to 0 or 5.


Thank you again for your help.
0 Kudos