Select to view content in your preferred language

Sample Flex Viewer 2.0 - Simple Headless Widget

968
8
07-23-2010 03:27 AM
CraigSturzaker
New Contributor
Hi,

I've been looking at implementing a simple headless widget in the SFV but I'm struggling to find a way to close or turn off the widget (i.e. clear the graphics layer) after it's been activated. 

Using the default SimpleHeadlessWidget that comes with the viewer, clicking the icon on the header controller performs a query and displays Louisville traffic cameras.  Any thoughts on how this layer can be cleared, without having to add an additional "clear layers" widget/icon to the header controller?

I thought it would be possible to add something to the widgetItemDG_widgetItemClickHandler function in the HeaderControllerWidget.mxml, but this doesn't seem to be called if the widget icon is clicked a second time.

Any thoughts or ideas on this would be appreciated.

Thanks,
Craig
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Craig,

   That is on the list of to do's for the development team, so probably best to just wait.
0 Kudos
CraigSturzaker
New Contributor
Ok, thanks Robert.
0 Kudos
CattyannCampbell
Frequent Contributor
Does this have anything to do with the red highlights I'm seeing on my polygons when I use the query widget? Its annoying because the whole layer is highlighted...
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Cattyann,

   The red selection color is controlled by the graphicLineSym and the graphicPolySym vars on lines 71 and 73 in the QueryWidget.mxml.
0 Kudos
CattyannCampbell
Frequent Contributor
Thanks
I'm aware something is controlling it thanks for the culprits but I don't have the ability to change this I'm using the Sample Viewer and no way of compiling MXML files so can't do anything with this. All I'm trying to do is get an identify with a hyperlink to work easy thing and worked OK in the previous Sample Viewer but since I've moved to this 2 beta widgets that were in 1.X have been hidden or removed in this version. It seems you have to compile just to get basic stuff to work in 2.0. I know that they aren't finished with this it is beta but the least the ESRI folks could have done is incorporate some of the widgets that were already out and about including the beautiful ones you have worked on and shared... They could have taken those and made them configurable out of the box. Perhaps you should talk these people into hiring you... You got my vote!

Thanks again!
0 Kudos
AlexJones
Emerging Contributor
Has anybody used this simple headless widget with a PolyLine? I am able to use any of my polygon or point layers but when I try to use a polyline it enters into the queryFeatures function, but never completes it/creates the ArrayCollection. I am not sure what else if anything I may need to change. Any help is appreciated. I am using the beta2.

Thank you,
Alex
0 Kudos
AlexJones
Emerging Contributor
Still hoping for some general help on the simple headless query. If I set this up using a line feature It will not work and enters into the catch block of the queryFeatures function every time. I thought maybe it was due to too many features, but I have tried various other services and I am still having issues. Points and polygons work just fine.

I understand it is a beta product and i am curious if I am hitting a beta issue or a limitation of my technical ability. Any help or ideas would be appreciated.

Thank you,
Alex
0 Kudos
AlexJones
Emerging Contributor
I think I was able to get to the bottom of my issue. In my mxml file inside the getGeomCenter function the code for the Geometry.POLYLINE was failing. I compared it to version 1.0 and noticed that the pathIndex line changed. Changing it back to the version 1.0 syntax has me up and running with this example.

I dont believe that I changed this info will help others. The code that is working for me is below.
Version 1.0 (Works)
case Geometry.POLYLINE:
     {
      var pl:Polyline = gra.geometry as Polyline;
      var pathCount:Number = pl.paths.length;
      var pathIndex:int = int((pathCount / 2) - 1);
      var midPath:Array = pl.paths[pathIndex];
      var ptCount:Number = midPath.length;
      var ptIndex:int = int((ptCount / 2) - 1);
      pt = pl.getPoint(pathIndex, ptIndex);
      break;
     } 


Version 2.0 (Not working for me)
var pathIndex:int = int(pathCount / 2) - 1;
0 Kudos