Table of Contents - Legend Widget for FlexViewer 2.x

99050
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
GregBowie
New Contributor II
The viewer is actually in beta testing and hidden behind a firewall; so that may be the issue there.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Greg,

  I would recommend learning and using an http traffic util like fiddler or charles, or you could use Firefox web browser with firebug addin to see what requests are being made and which ones are failing.
0 Kudos
AdrianKordylas
New Contributor
Adrian,

   Wow I can't believe you are the first to report this issue. The fix is 2 simple lines of code and I will add them to the next release. If you happen to be using the uncompiled version than you can add the fix your self by opening the TocMapLayerItem.as and find the loadImage function and add the two lines below in red:

        private function loadImage(imageData:String):Image
        {
            const base64Dec:Base64Decoder = new Base64Decoder();
            base64Dec.decode(imageData);
            const byteArr:ByteArray = base64Dec.toByteArray();
            
            const loader:Loader = new Loader();
            const lc:LoaderContext = new LoaderContext(false);
            const image:Image = new Image();
            image.maxHeight = 30;
            image.maxWidth = 30;
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
                function(e:Event):void
                {
                    image.smoothBitmapContent = true;
                    image.source = e.currentTarget.content;
                });
            loader.loadBytes(byteArr, lc);
            return image;
        }


Also you may want to st your maps top attribute back to 40 unless you have some reason for the 100 empty pixels above your map.

Don't forget to click the top arrow (promote).
as shown in the below graphic:


I will wait for the next release because I don't now how I can install the uncompiled version 🙂

Adrian
0 Kudos
ANDREACARVELLI
New Contributor
Hi Robert, I'm using TOC widget in a FlexViewer 2.5 with ArcGIS 10 map services. I've noticed that moving up and down map services sometimes happens that a visible dummy item is placed between two map services. It still present in new TOC version (2.5.1.1) do you have any idea?
Thanks,
Andrea
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Andrea,

   The only way this should be able to occur is if you did not heed my warning in the documentation

* It is your responsibility to disable the layerlist portion of the MapSwitcherWidget or eMapSwitcherWidget by setting the        *
* <layerlist visible="false">                                                        *
* Also ensure you do not use the TOCWidget with the LayerListWidget.                                    *
0 Kudos
GiosiaPoma
New Contributor III
Hi Robert,
I've reported this problem of big images in TOC in this post and after your suggestions I've posted the solution

Now this post is too big and not easy to find solutions... Thank you for all!

Adrian,

   Wow I can't believe you are the first to report this issue. The fix is 2 simple lines of code and I will add them to the next release. If you happen to be using the uncompiled version than you can add the fix your self by opening the TocMapLayerItem.as and find the loadImage function and add the two lines below in red:

        private function loadImage(imageData:String):Image
        {
            const base64Dec:Base64Decoder = new Base64Decoder();
            base64Dec.decode(imageData);
            const byteArr:ByteArray = base64Dec.toByteArray();
            
            const loader:Loader = new Loader();
            const lc:LoaderContext = new LoaderContext(false);
            const image:Image = new Image();
            image.maxHeight = 30;
            image.maxWidth = 30;
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
                function(e:Event):void
                {
                    image.smoothBitmapContent = true;
                    image.source = e.currentTarget.content;
                });
            loader.loadBytes(byteArr, lc);
            return image;
        }


Also you may want to st your maps top attribute back to 40 unless you have some reason for the 100 empty pixels above your map.

Don't forget to click the top arrow (promote).
as shown in the below graphic:
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Giosia,

   Thanks for reminding me. With 20 plus widgets in the gallery and all I do on the forums it is hard to keep it all straight. In the next release I will have the maxHeight and maxWidth set, (not sure why I didn't get that in when you pointed it out...).
0 Kudos
DerekHunter1
New Contributor II
Great widget Robert.  Your work really helps many.

Is it possible to compile the source code using the Flex API 3.0 library for use in the pre-released ArcGIS Flex Viewer 3.0?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Derek,

   All my widget will work with 3.0 when it has gone final. There is still alot going on as far as changes to the 3.0 Pre Release (you shound never really use a pre release for production).
0 Kudos
DerekHunter1
New Contributor II
Thanks.  I'm just in preparation.
0 Kudos