<esri:Map id="map"> <esri:ArcGISTiledMapServiceLayer url="http://mapurl"/> </esri:Map> <applications:ComplexLocator MapControl="{map}"> </applications:ComplexLocator> </s:Application>
protected function basewidget_creationCompleteHandler(event:FlexEvent):void { var legend:LegendViewer=new LegendViewer(); legend.percentHeight=100; legend.percentWidth=100; legend.map=map; wTemplate.addElement(legend); }