Select to view content in your preferred language

emapswitcher widget cannot change the copyright information?

942
6
Jump to solution
03-06-2012 01:55 AM
AYounas
Occasional Contributor
Hi,

First of all thanks for such a lovely widget.

It is working fine except when I move the slider it changes the basemap but is not changing the copyright information related to that basemap. I am using latest FV and also copyright widget to display this information.

Any help would be highly appreciated.

Thanks,

Adi
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Adi,

   Yes the same place in 2.5 but you need to add the import for AppEvent as well.

            import com.esri.viewer.AppEvent;

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus
Adi,

   Seems how you are using Flex Viewer 2.4 you will have to add the code change to make this happen in your 2.4Versionof the eMapSwitcherWidget.

In the BasemapButtonBar.mxml find the faderFade function and add the line below in red:

            public function faderFade(event:Event):void
            {
                //Special thanks to Mark Hoyland for portions of this code.
                
                var layers:ArrayCollection = map.layers as ArrayCollection;
                var layer:Layer;
                
                //As there is normally just one Base Map visible in Flex Viewer at a time
                //turn on all the basemap layers so they can be faded
                for (var x:int = 0; x < dataProvider.length; x++){
                    var basemapLbl:String = dataProvider.getItemAt(x).label;
                    for each (layer in layers)
                    {
                        if (layer.id == basemapLbl)
                            layer.visible = true;
                    }
                }
                
                var currentValue:Number = event.currentTarget.value;
                var floorValue:Number = Math.floor(event.currentTarget.value);
                
                //Special thanks to Mattias Ekström for these 2 lines
                selectedIndex = Math.round(currentValue) - 1;
                stage.focus = null;
                
                AppEvent.dispatch(AppEvent.BASEMAP_SWITCH, dataProvider.getItemAt(selectedIndex).id);
                
                //set the alpha if it is less than the the max value 
                if (currentValue < event.currentTarget.maximum){
                    var basemapLabel:String = dataProvider.getItemAt(floorValue).label;
                    for each (layer in layers){
                        if (layer.id == basemapLabel)
                            layer.alpha = currentValue - floorValue;
                    }
                }
                
                //set the alpha for the previous layer one OR the last layer
                var basemapLabel2:String = dataProvider.getItemAt(floorValue-1).label;
                for each (layer in layers){
                    if (layer.id == basemapLabel2)
                        layer.alpha = 1 - (currentValue - floorValue);
                }
                
                //reset the alpha to zero for the layers that are not being merged.
                //This is needed to cater for a track click
                for (var i:int = 0; i < dataProvider.length; i++){
                    if (i > floorValue || i < floorValue - 1){
                        var basemapLabel3:String = dataProvider.getItemAt(i).label;
                        for each (layer in layers){
                            if (layer.id == basemapLabel3)
                                layer.alpha = 0;
                        }
                    }
                }
            }


Don't forget to click the Mark as answer check and to click the top arrow (promote) as shown below:
0 Kudos
AYounas
Occasional Contributor
Thank-you Robert for your reply.

I am using Flexviewer 2.5. Will it be the same line as I tried and it gave me a message which is obvious that is "appevent" is undefined. Any suggestion please?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Adi,

   Yes the same place in 2.5 but you need to add the import for AppEvent as well.

            import com.esri.viewer.AppEvent;
0 Kudos
AYounas
Occasional Contributor
Robert,

Many thanks once again! It worked absolutely fine.

Thanks,

Adnan
0 Kudos
LewisLock
Deactivated User
Why are the (Feature) layer's labels ignored by this widget??!!!  Other than that (and its a biggie), this widget is great.  Sigh.  Lewis.
0 Kudos
LewisLock
Deactivated User
--sorry reposting the above comment to the thread for Robert's TOC widget.  Lewis
0 Kudos