Pure Custom Components vs FlexView

642
2
05-10-2011 10:28 AM
DylanRoy
New Contributor
I have been noticing that many people have been using FlexViewer to create new mashups. I on the other hand had decided to go the pure custom component approach and just take in the map as an attribute. This way all the user of any my components needs to do is drag each component onto their Flash Builder canvas and point them to the map they want it to interact with. I am just curious as to why many opt to build their User Controls upon FlexViewer and what are the advantages of using it. I just want to make sure I am not missing out on anything.

Client App Example with Component:
        ...snippet...
 <esri:Map id="map">
  <esri:ArcGISTiledMapServiceLayer url="http://mapurl"/>
 </esri:Map>
 <applications:ComplexLocator MapControl="{map}">
 </applications:ComplexLocator>
</s:Application>
Tags (2)
0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor
I would think it's that Flexviewer provides the basic foundation for an app, so someone can quickly get an app up and running without having to fuss with building out their app structure, event dispatchers, controllers and so on. It's pretty quick to get a widget up and going and drop it into Flexviewer.

We have a couple of Flexviewer apps at work which has prompted me to build a few widgets in-house.
Mainly, I build apps from scratch though, for various reasons and there are tools/workflows to get up and running such as ANT build/structure scripts, ProjectSprouts, Frameworks, etc.

That doesn't mean your widgets need to built in such a way that they have to be tightly coupled to Flexviewer. I've been meaning to write more about this, but I put an example up of a widget where the component itself sits in a completely different package than the widget.
http://www.arcgis.com/home/item.html?id=708ae903d3994999a3a861f35bf7408d
Basewidget just adds the component and provides the map instance.
protected function basewidget_creationCompleteHandler(event:FlexEvent):void
{
 var legend:LegendViewer=new LegendViewer();
 legend.percentHeight=100;
 legend.percentWidth=100;
 legend.map=map;
 wTemplate.addElement(legend);
}

The same component can be used in a completely non-Flexviewer app.

I've seen a few other widgets built this way as well and I think it's good practice, especially when a Flexviewer update comes out. Then you would not need to modify the component itself in that case. The most you'd have to worry about is if the API requries you to change your component in some way.
Now I'm rambling, but in general, I think it comes down to time restraints and manpower.
0 Kudos
DylanRoy
New Contributor
You were very quick to respond to my post. This was a very informative read, and I appreciate the time you took in your response.

Thanks,

Dylan
0 Kudos