POST
|
Hi Rschietlin turns out i had implemented it in the way you corrected it. and it still didn't work, but if i tried it in a 'clean' version of 2.4 flexveiwer ( i.e. no customisation) and it worked got very depressed at this as i though it meant i would have major issues Then by accident i tried it in my application with a layer that did not have a visibility limit ( visible at all scales ) and it worked so turns out that if i have the features visibility limited to a certain scale this method doesn't work ANSWER is ( drum roll .....) use featureLayer.addEventListener(LayerEvent.IS_IN_SCALE_RANGE_CHANGE, checkMapScale); instead of featureLayer.addEventListener(LayerEvent.UPDATE_END, checkMapScale);
... View more
09-20-2012
12:20 AM
|
0
|
0
|
342
|
POST
|
Phew, thats is good news i thought i had totally misunderstood how event worked thanks for your quick response i will implement know and then tick box as answered etc
... View more
09-19-2012
10:10 PM
|
0
|
0
|
342
|
POST
|
Hi rscheitlin, sorry but now i am really confused, in example how would the checkMapScale function get called? seem that it is calling itself if map.scale <100000 private function checkMapScale(event:LayerEvent){
if(map.scale < 100000){
featureLayer.addEventListener(LayerEvent.UPDATE_END, checkMapScale);
}
}
i am missing something would i put a line in the if statement within the addLayertoMap function (MapManager.mxml) which had the ventlistener in it and tell it to run checkMapScale ?
... View more
09-19-2012
08:00 PM
|
0
|
0
|
342
|
POST
|
Hi sorry you are exactly correct. i should add details of project viewer - 2.4 layer - feature layer my problem is how and where to implement it the layer gets added dynamically from a table the user selects project from. some projects only want to have visibility down to 1:100000 i need to add an eventlistener on the ZOOM event and if map.scale < layer.visibility then infowindow.hide() so i assume i just write a simple function with logic described above (map.scale < ... etc)that gets called when the zoom event is fired but where would i write this? should i add this to mapManager.mxml?
... View more
09-18-2012
08:51 PM
|
0
|
0
|
342
|
POST
|
Hi sorry can you please point me towards some documentation on How To use Event Listeners, i thought i knew how to do it and that this was straight forward but i can not work it out ( missing something simple ). As you mentioned all i need to do is add an event listener to the layer that checks its visibility and if not visible hides the info window
... View more
09-16-2012
04:10 PM
|
0
|
0
|
342
|
POST
|
Hi anyone tell me how i can hide the popup when the feature is no longer visible due to scale visibility (using map.infoWindow.hide()) i have feature that are no visible below 1:100000, if a click on a feature to get the popup, if i then zoom further ( i.e. below 1:100000) the feature is no longer visible but the popup is, if keep zooming i can zoom to map extent and the whole time the pop up is pointing to the feature ) i have made it hide popup if the user changes to the zoom tool or the pan tool but if they use "double click" on map or the scroll wheel i cannot hide the popup any ideas?
... View more
09-11-2012
05:27 PM
|
0
|
9
|
2104
|
POST
|
hi anyone know how to close a popup ( with code We are using 2.4 still) we have an app that adds layers based on a users choice of project from a table when the user clicks the button to select a new project i want any pop us they have open to close i thought this should be easy i use PopUpmanger.removePopup(map) on the click event of choose another but this does nothing ?
... View more
09-10-2012
05:00 PM
|
0
|
2
|
752
|
POST
|
Hi i have same problem with inability to add an image to Description field using <img> tag i resolved that if you hard code the url to image ( instead of using a field) it works. ( but this is almost usless) i also found that if you use the Media tag all works OK for first click of popup then popup break you on get image, no text fileds ANSWER is to use both <decscription> and <fileds> tags ( yes despite what the documentation says) put all your text fields in <Description> and all your media fields in <fields> and in <Media> and hey presto pop ups that always work
<configuration>
<title>Threatened Species - {TYPE}</title>
<description>
<![CDATA[<b>Site Name:</b><BR>{SITENAME}<BR>{PROJ_DESC}<BR><BR><b> Links: </b><BR><a href='{LINK}'><u>Factsheet</u></a><BR><a href='{LINK2}'><u>Website</u></a>]]>
</description>
<fields>
<field name="PIC"/>
<field name="PIC2"/>
<field name="PIC_LBL"/>
<field name="PIC2LBL"/>
</fields>
<medias>
<media type="image" title="{PIC_LBL} - Click to view larger" imagesource="{PIC}" imagelink="{PIC}"/>
<media type="image" title="{PIC2LBL} - Click to view larger" imagesource="{PIC2}" imagelink="{PIC2}"/>
</medias>
</configuration>
... View more
09-06-2012
10:59 PM
|
0
|
0
|
238
|
POST
|
OK we figured it out was very simple in end just needed to pass another variable to get_rel function , it still doesn't populate in editor form but edits are applied to data base here is code for those interested; private function featureLayer_selectionComplete(event:FeatureLayerEvent):void { for each (var field:Field in event.target.layerDetails.fields) { if (field.type == Field.TYPE_DATE) { for each (var feature:Graphic in event.features) { var date:Date = new Date(feature.attributes[field.name]); if (date.milliseconds == 999) { date.milliseconds++; //Add 1ms to date values ending in 999 to workaround REST date bug feature.attributes[field.name] = date.time; } } } if (field.name == "NAME_REL") { getRel(event.featureLayer,feature,"Paddock - Yard","NAME_P"); field.editable = false; } if (field.name == "CREATEDATE") { if(feature.attributes[field.name] == null) { var newDate:Date = new Date(); feature.attributes[field.name] =newDate.time; } field.editable = false; } if (field.name == "LASTUPDATE") { var lastdate:Date = new Date(); feature.attributes[field.name] = lastdate.time; field.editable = false; } } var updates:Array = [ feature ]; event.featureLayer.applyEdits(null, updates, null); layername = event.featureLayer.name; } private function getRel(featureTrg:FeatureLayer,featureRel:Graphic,lyr:String,field:String):void { var name:String; var fid:String; var query:Query = new Query(); query.geometry = featureRel.geometry; var featureLayer:FeatureLayer = map.getLayer(lyr) as FeatureLayer; featureLayer.queryFeatures(query, new AsyncResponder(onResult, onFault)); function onResult(featureSet:FeatureSet, token:Object = null):void { if (featureSet.features.length > 0) { for each (var myGraphic:Graphic in featureSet.features) { fid = myGraphic.attributes["ID"]; featureRel.attributes["RID"] = fid; if (myGraphic.attributes[field] != null) { name = myGraphic.attributes["NAME_P"]; featureRel.attributes["NAME_REL"] = name; } else { Alert.show("No " + lyr + " name found."); } var updates:Array = [ featureRel ]; featureTrg.applyEdits(null, updates, null); } } else { Alert.show("No " + lyr + " found. Are you sure you want to add this without a " + lyr + "?"); } }
... View more
06-24-2012
10:10 PM
|
0
|
0
|
244
|
POST
|
Flex viewer 2.5 Hi we are using the selection complete event of the editor widget to auto populate some fields when a feature is edited we use this to populate the field that relates two feature classes in this case the filed NAME_REL, the function sends varaible to a second function Get_rel that runs a spatial query and populates the fields problem is that the fields that are calculated in the get_rel function using spatial query do not make it to the editor form before it opens ans as such are not saved, the fields that are calculated directly in selection complete function are in the editor form when it opens and are this saved. this is despite the apply edits parts of the functions, this does "apply the edits" if i use the info tool to query the feature the relevant fields have the nec values but if i close application and reopen the values have not been saved Can someone please advise me as to how to make the selection complete function wait for the Get_rel function to complete before it concludes, is this an even listener scenario?, if so how would i implement it ? private function featureLayer_selectionComplete(event:FeatureLayerEvent):void { for each (var field:Field in event.target.layerDetails.fields) { if (field.type == Field.TYPE_DATE) { for each (var feature:Graphic in event.features) { var date:Date = new Date(feature.attributes[field.name]); if (date.milliseconds == 999) { date.milliseconds++; //Add 1ms to date values ending in 999 to workaround REST date bug feature.attributes[field.name] = date.time; } } } if (field.name == "NAME_REL") { getRel(feature,"Paddock - Yard","NAME_P"); field.editable = false; } if (field.name == "CREATEDATE") { if(feature.attributes[field.name] == null) { var newDate:Date = new Date(); feature.attributes[field.name] =newDate.time; } field.editable = false; } if (field.name == "LASTUPDATE") { var lastdate:Date = new Date(); feature.attributes[field.name] = lastdate.time; field.editable = false; } } var updates:Array = [ feature ]; event.featureLayer.applyEdits(null, updates, null); layername = event.featureLayer.name; } private function getRel(feature:Graphic,lyr:String,field:String):void { var name:String; var fid:String; var query:Query = new Query(); query.geometry = feature.geometry; var featureLayer:FeatureLayer = map.getLayer(lyr) as FeatureLayer; featureLayer.queryFeatures(query, new AsyncResponder(onResult, onFault)); function onResult(featureSet:FeatureSet, token:Object = null):void { if (featureSet.features.length > 0) { for each (var myGraphic:Graphic in featureSet.features) { fid = myGraphic.attributes["ID"]; feature.attributes["RID"] = fid; if (myGraphic.attributes[field] != null) { name = myGraphic.attributes["NAME_P"]; feature.attributes["NAME_REL"] = name; } else { Alert.show("No " + lyr + " name found."); } var updates:Array = [ feature ]; featureLayer.applyEdits(null, updates, null); Alert.show(feature.attributes["NAME_REL"],"Get Rel NAME_REL") Alert.show(feature.attributes["RID"],"Get Rel RID") } } else { Alert.show("No " + lyr + " found. Are you sure you want to add this without a " + lyr + "?"); } } function onFault(info:Object, token:Object = null):void { Alert.show(info.faultString + "\n\n" + info.faultDetail, "queryTask fault " + info.faultCode); } }
... View more
06-24-2012
03:34 PM
|
0
|
1
|
2481
|
POST
|
Hi i dont think you can access shape fields in with a feature service, i have had to add the same services as a maps services, make the polygons have no symbology and then label the polygons with the area filed, users can then see the area of the polygon they just made as a label
... View more
06-21-2012
05:04 PM
|
1
|
0
|
1466
|
POST
|
I assume what you are trying to do is show the length of the line as a label after you have created it with the edit widget. You cannot label features from a feature service, You will need to create a second map service with the features in it, make them have no symbology add that to your map and it will then label them
... View more
06-20-2012
04:01 PM
|
0
|
0
|
162
|
POST
|
Hi i figured out cause of problem now i need to find solution. Problem is secured services, the app uses secured services and the Esearch widget wont work with the, ( i moved th services to non-secured folder and presto it worked ) Thanks GISProgrammer9 that is exactly the kind of questions that needed to be asked to resolve the issue ( if it wasn't secure services issues ) does anyone have any ideas on how to make this widget work with secure services??
... View more
06-03-2012
03:34 PM
|
0
|
0
|
253
|
POST
|
Thanks anthony, it does seem as if that is what is happening (thats why it cant find it ) but the two databases (DEVEL and PROD) are copies of each other so if eSearch widget works on one should work on both I have now found that is happens with the normal search widget and also with any layer i put into it from the PROD server
... View more
05-31-2012
03:35 PM
|
0
|
0
|
253
|
Title | Kudos | Posted |
---|---|---|
1 | 06-21-2012 05:04 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|