<?xml version="1.0" encoding="utf-8"?> <mx:UIComponent xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:esri="http://www.esri.com/2008/ags" width="100%" height="100%" > <esri:WMSLayer id="wmslayer1" /> <esri:GraphicsLayer id="layer2" /> <esri:GraphicsLayer id="layer3" /> <esri:GraphicsLayer id="layer4" /> <esri:GraphicsLayer id="layer5" /> </mx:UIComponent>
The UIComponent class is the base class for all visual components, both interactive and noninteractive.The UIComponent class is not used as an MXML tag, but is used as a base class for other classes.
private var myGraphicsLayersCollection:ArrayCollection = new ArrayCollection(); private function addGraphicsLayerToCollection():void { var grLayer:GraphicsLayer = new GraphicsLayer(); grLayer.id = "grLayer1"; grLayer.name = "First Gr Layer"; myGraphicsLayersCollection.addItem(grLayer); } private function getGraphicsLayerFromCollectionById(layerId:String):GraphicsLayer { for each (var layer:GraphicsLayer in myGraphicsLayersCollection) { if (layerId == layer.id) { return layer; } } return null; } private function removeGraphicsLayerFromCollectionById(layerId:String):Boolean { var isRemoved:Boolean = false; for each (var layer:GraphicsLayer in myGraphicsLayersCollection) { if (layerId == layer.id) { var index:int = layerList.getItemIndex(layer); layerList.removeItemAt(index); isRemoved = true; break; } } return isRemoved; } private function collectionToMap():void { for each (var layer:GraphicsLayer in myGraphicsLayersCollection) { // each layer extends UIComponent, so its ID is unique var existingLayer:Layer = mapMap.getLayer(layer.id); if (!existingLayer) mapMap.addLayer(layer); } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.