|
POST
|
If you use the 4.5 hero sdk with the ESRI 2.2 Flex API, you'll need to manually add the halo swc's. As described briefly here http://thunderheadxpler.blogspot.com/2010/11/how-to-use-esri-flex-api-on-android-and.html Now, to compile the application using Flash Builder Burrito, make sure to include in the libs project folder the flexapi swc and make sure to copy from the Flex sdks folder (under the burrito application folder) the mx.swc and the sparkskins.swc files. For the next release of our swc will not require the last two swc, just add them for now. The Flex team has stated before there were some comps that they use that did not have viable Spark counterparts, that should be alleviated with the final Flex 4.5 release.
... View more
04-13-2011
07:38 AM
|
0
|
0
|
587
|
|
POST
|
Since you're implementing IGraphicRenderer you can set that logic in the graphic setter. public function set graphic(value:Graphic):void{} When dealing with states in a SkinnableComponent you may need to override the following functions.
override public function initialize():void
{
super.initialize();
states.push(new State({name:"state1"}));
states.push(new State({name:"state2"}));
currentState = "state1";
}
override protected function getCurrentSkinState():String
{
return currentState;
}
override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
{
super.stateChanged(oldState, newState, recursive);
invalidateSkinState();
}
Then in the graphic setter, change the state based on the attribute data.
... View more
04-11-2011
10:50 AM
|
0
|
0
|
510
|
|
POST
|
The GraphicEvent.GRAPHIC_ADD method is probably your best approach. I tried it out and it works on all Selection Modes and gives you access to the graphic when it is added.
package org.lacsd.layers
{
import com.esri.ags.Graphic;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.events.GraphicsLayerEvent;
import com.esri.ags.layers.FeatureLayer;
import flash.events.MouseEvent;
import mx.utils.ObjectUtil;
public class TestFeatureLayer extends FeatureLayer
{
public function TestFeatureLayer(url:String=null, proxyURL:String=null, token:String=null)
{
super(url, proxyURL, token);
this.addEventListener(GraphicEvent.GRAPHIC_ADD, onGraphicAdd);
this.addEventListener(GraphicEvent.GRAPHIC_REMOVE, onGraphicRemove);
this.addEventListener(GraphicsLayerEvent.GRAPHICS_CLEAR, onGraphicsClear);
}
private function addListener(graphic:Graphic):void
{
graphic.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void
{
graphic.useHandCursor = true;
graphic.buttonMode = true;
map.openHandCursorVisible = false;
trace("mouse over");
});
graphic.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void
{
graphic.useHandCursor = false;
graphic.buttonMode = false;
map.openHandCursorVisible = true;
trace("mouse out");
});
graphic.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void
{
trace("Click");
})
}
private function onGraphicAdd(event:GraphicEvent):void
{
trace("graphic has been added", ObjectUtil.toString(event.graphic.attributes));
this.addListener(event.graphic);
// add listeners here
}
private function onGraphicRemove(event:GraphicEvent):void
{
trace("graphic has been removed", ObjectUtil.toString(event.graphic.attributes));
// remove listeners here
}
private function onGraphicsClear(event:GraphicsLayerEvent):void
{
// may want to find a way to remove listeners here or add them with a weak reference
}
}
}
I think the reason you can't override the add() method for FeatureLayer is because the internal Relate/Query tasks interact directly with the GraphicsProvider/SelectedFeatures.
... View more
03-29-2011
05:56 AM
|
0
|
0
|
1027
|
|
POST
|
I don't see in the docs where overriding the add() method is not supported. http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/GraphicsLayer.html#add() According to the docs you could add your listeners there, then call super.add(graphic). I usually try to assign my changes before calling the super. Or you could add a listener in your constructor for com.esri.ags.events.GraphicEvent.GRAPHIC_ADD event and do it that way.
... View more
03-26-2011
10:33 AM
|
0
|
0
|
1027
|
|
POST
|
Well, not really ideal, but I fixed this by changing the s:ItemRenderer to a mx:Canvas. I'd prefer to not mix halo/spark, but it works as long as I remember to check that spark comps have been created.
... View more
03-18-2011
09:14 AM
|
0
|
0
|
473
|
|
POST
|
I am trying to set the InfoWindow title via my ItemRenderer that I am assigning to a FeatureLayer. I can set the title from the map.infoWindow.label, but my ItemRenderer doesn't have access to the map and the title will vary among FeatureLayers. All the samples are still using mx comps with inline ItemRenderers. Spark containers don't have a label field and mine are set up from ClassFactory in AS3. I tried setting the ItemRenderer label (label="{data.Type}"), but that doesn't seem to get reflected in the InfoWindow. Do I need to extend the InfoWindow to add this or is there a simpler method of setting the InfoWindow title? For example, here is my ItemRenderer that is assigned to one Featurelayer. Can I set the InfoWindow title from this ItemRenderer?
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
autoDrawBackground="false"
label="{data.Type}">
<fx:Script>
<![CDATA[
override public function set data(value:Object):void
{
super.data = value;
// TODO - calc lat/longs, parse img data
lblCost.text = stringValue(value.COSTINFO)
lblLease.text = stringValue(value.LEASEINFO);
lblLease2.text = stringValue(value.LEASEINFO2);
lblMeter.text = stringValue(value.METERINFO);
lblElec.text = stringValue(value.ELECTRICAL);
}
private function stringValue(value:String):String
{
return (value.length > 1) ? value : "None";
}
]]>
</fx:Script>
<s:Group id="grpMain"
width="100%"
height="100%">
<s:layout>
<s:HorizontalLayout gap="8"
paddingBottom="5"
paddingLeft="5"
paddingRight="5"
paddingTop="5" />
</s:layout>
<s:Group id="fieldNames">
<s:layout>
<s:VerticalLayout gap="2" />
</s:layout>
<s:Label text="Lat:" />
<s:Label text="Long:" />
<s:Label text="Image: " />
<s:Label text="Cost Info:" />
<s:Label text="Lease Info:" />
<s:Label text="More Lease Info:" />
<s:Label text="Meter Info:" />
<s:Label text="Electrical Info:" />
</s:Group>
<s:Group id="fieldValues">
<s:layout>
<s:VerticalLayout gap="2" />
</s:layout>
<s:Label id="lblLat" />
<s:Label id="lblLong" />
<s:Label id="lblImage" />
<s:Label id="lblCost" />
<s:Label id="lblLease" />
<s:Label id="lblLease2" />
<s:Label id="lblMeter" />
<s:Label id="lblElec" />
</s:Group>
</s:Group>
</s:ItemRenderer>
... View more
03-18-2011
07:52 AM
|
0
|
1
|
818
|
|
POST
|
This thread covered how to close multiple widgets http://forums.arcgis.com/threads/25015-Closing-Multiple-Widgets But my post in there should work to close a single widget. After that, it requires a little more work.
... View more
03-09-2011
12:42 PM
|
0
|
0
|
2604
|
|
POST
|
Sorry for the delay. I've updated the source code this morning. http://www.arcgis.com/home/item.html?id=c663df2846d04a6b9add92b66c637728 You can now define the output Spatial Reference wkid for your Locator service so that it will match your map services. I tested it briefly without issue, but if anything does not work please let me know. Thanks.
... View more
03-09-2011
07:28 AM
|
0
|
0
|
1775
|
|
POST
|
I'll look over the code, but there is a section when I initialize the locator, that I set the output Spatial Reference to geographic. I've been meaning to add that as an xml option.
... View more
03-08-2011
09:40 AM
|
0
|
0
|
1775
|
|
POST
|
I checked the source and I don't block geocoding if there is no city/zip, but depending on the Locator service you are using, you may have to change this in the source code. widgets.BatchGeocoder.helpers
/**
* Will parse the item passed to this class and prepare it for
* use with ArcGIS Server geocoder.
* @param item
* @return
*/
protected function buildAddressObject(item:Object):Object
{
var address:String = "";
var city:String = "";
var state:String = "";
var zip:String = "";
var country:String = "USA";
if (_addressField.length > 0)
address = item[_addressField];
if (_cityField.length > 0)
city = item[_cityField];
if (_stateField.length > 0)
_stateField = item[_stateField];
if (_zipField.length > 0)
zip = item[_zipField];
if (_countryField.length > 0)
country = item[_countryField];
// You may need to modify these fields to work with your
// particular locator service
return {
Address:address,
City:city,
State:state,
Zip:zip,
Country:country
};
}
That is the address object that gets created when you map the fields from your dbf. You may need to change Address to Street. You may even be able to eliminate all fields except for address in your case. I test against this geocodeserver. http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer
... View more
03-07-2011
04:39 PM
|
0
|
0
|
1775
|
|
POST
|
I'll check over source when I get home. This could be left over from a limitation I had in my code where our internal locator required a city or zip. I'll see if I can fix that. Thanks for pointing it out.
... View more
03-07-2011
07:42 AM
|
0
|
0
|
1775
|
|
POST
|
Looking at the Query Widget, it looks like the query is just run the one time on the first load and results parsed and stored in queryResultAC. This is probably to save the time of having to rerun the query each time you close/open the widget. If you'd like to zoom the query results each time the widget is open, you can listen for the addedToStage event on something. I tried it out and added it to the QueryResultDataGroup <Query:QueryResultDataGroup id="queryResultDG" addedToStage="queryResultDG_addedToStageHandler(event)" ... Then do something like this.
protected function queryResultDG_addedToStageHandler(event:Event):void
{
if (graphicsLayer) // need this because on first load, value is null
map.extent = GraphicUtil.getGraphicsExtent(ArrayCollection(graphicsLayer.graphicProvider).toArray());
}
That should get you started.
... View more
03-03-2011
01:13 PM
|
0
|
0
|
632
|
|
POST
|
Ok, it's updated. http://www.arcgis.com/home/item.html?id=bed0140d93ee49d8b8f8f1a5b7310c6f You can check out a demo here. http://odoe.net/thelab/flex/flexviewer/index.html?config=config-layersmanager.xml If you really wanted to change the text color, you could edit the LegendManageraSkin.mxml as such.
<s:Scroller height="100%"
width="100%">
<!-- add a color value for the DataGroup -->
<s:DataGroup id="legendDataGroup" color="0xffff00"
itemRendererFunction="itemRenFunc">
<s:layout>
<s:VerticalLayout gap="2"
horizontalAlign="justify" />
</s:layout>
</s:DataGroup>
</s:Scroller>
I've thought about swf loadable stylesheets, but wasn't sure about it for widgets. (i.e. compile css to swf for widget swfs)
... View more
03-03-2011
10:20 AM
|
0
|
0
|
737
|
|
POST
|
I've been meaning to fix the itemRenderers for this. Probably best solution would be to open these 2 itemRenderers in the source. LayerListItemRenderer.mxml LayerListDynamicItemRenderer.mxml change the alpha value of the <s:Rect> to 0.
<s:Rect left="0"
right="0"
top="0"
bottom="0">
<s:fill>
<s:SolidColor color="#F0F8FF"
alpha="0" /> <!-- change this from 0.6 t0 0 -->
</s:fill>
</s:Rect>
I'll update the source and compiled swc in zip after lunch today.
... View more
03-03-2011
10:01 AM
|
0
|
0
|
737
|
|
POST
|
Not too familiar with the innards of the Flexviewer framework, but looking at the WidgetTemplate and BaseWidget, I don't think calling the MouseEvent is the best way to go about it. After some tinkering I was able to close a widget programatically this way.
ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_CHANGE_STATE, {id: this.widgetId, state:WidgetStates.WIDGET_CLOSED}));
So if you can iterate through the widget ids, you should be able to dispatch that event for each widget you want to close. Looking at the event chain on the close_clickHandler for the WidgetTemplate, you may want to set the widget.widgetState before dispatching the ViewContainer event. Just tested on multiple widgets, nevermind, that doesn't work either.
... View more
03-03-2011
08:25 AM
|
0
|
0
|
1262
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM | |
| 1 | 12-31-2025 09:05 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|