Select to view content in your preferred language

Graphics layer symbol from DB....

1795
2
05-13-2011 04:00 PM
raffia
by
Deactivated User
Dear all developers, its been a week I have been trying to solve this minor issue, so any help is highly appreciated.

I have a point layer that loads into a graphics layer in the app representing commercial advertisers. Initially I embedded the symbol with a code that worked fine (pasted below), as I only had three entries, the embedding was fine, and I was checking the query result for name, and with If statements, I was assigning the graphics symbol. Here is the relevant parts of the code that worked. Am using the 2.3 flex API with Flex Builder 4

The Embed code that worked fine:
  


[Embed(source='images/Commercial_Logos/ZAS.png')] 
private var picEmbeddedZAS:Class;
private var zasMarkerPicture:PictureMarkerSymbol = new PictureMarkerSymbol(picEmbeddedZAS);

  

   private function doQueryComm() : void
   {
    queryCommercial.geometry = myMap.extent; 
    queryTaskCommercial.execute( queryCommercial, new AsyncResponder( onCommResult, onCommFault  ));
    
   }
 
   private var commData:Object;
   
   private function commercialClickHandler (event:MouseEvent):void
   {

    commData = event.target.parent.attributes;    
    commIdentVariable = new commercialDetailsWindow();
    PopUpManager.addPopUp(commIdentVariable, this, false);
   }
   
   private function onCommResult( featureSet : FeatureSet, token : Object = null ) : void
   {     
    for each ( var myCommGraphic : Graphic in featureSet.features )
    {
     
//here is where I check for the name, and assign the symbol
if (myCommGraphic.attributes.Name == 'ZAS - Z Aviation Services')
     {
      myCommGraphic.toolTip = 'ZAS - Z Aviation Services';
      myCommGraphic.symbol = zasMarkerPicture;
      commGraphicsLayer.add(myCommGraphic);
     }
    }
   }

  <esri:QueryTask id="queryTaskCommercial" url="http://arcgis2.roktech.net/ArcGIS/rest/services/DigitalEg/English/MapServer/3"/>        
  <esri:Query id="queryCommercial" outFields='["Name" , "Type" ,  "LargeLogo" , "SmallLogo"]'
      returnGeometry="true" />    


<esri:Map id="myMap" extentChange="doQueryComm();">

 <esri:GraphicsLayer id="myCommGraphicsLayer" symbol="{mySFS}"/>  
 <esri:GraphicsLayer id="commGraphicsLayer" click="commercialClickHandler(event);" >                
 </esri:GraphicsLayer>

 
</esri:Map>



I am attempting to load the path to the symbol source from a field called SmallLogo, I tried assigning the source using a variety of methods, and it failed in all. I tried to assign the source to myCommGraphic.attributes.SmallLogo and then to commData.SmallLogoLogo, both didn't work. Below is my last attempt to do so.


 private var commData:Object;
 private var commercialMarkerPicture:PictureMarkerSymbol ;
 private function doQueryComm() : void
 {
 queryCommercial.geometry = myMap.extent; 
 queryTaskCommercial.execute( queryCommercial, new AsyncResponder( onCommResult, onCommFault  ));
 
 }
 private var commData:Object;
 private var commercialMarkerPicture:PictureMarkerSymbol 
 
 
 private function onCommResult( featureSet : FeatureSet, token : Object = null ) : void
 {     
 for each ( var myCommGraphic : Graphic in featureSet.features )
 {
 
 myCommGraphic.toolTip = commData.Name;
 commercialMarkerPicture = new PictureMarkerSymbol( myCommGraphic.attributes.SmallLogo)  ; 
 myCommGraphic.symbol = commercialMarkerPicture;
 commGraphicsLayer.add(myCommGraphic); 
 
 
 }
 } 
 
 
 private function commercialClickHandler (event:MouseEvent):void
 {

 commData = event.target.parent.attributes;    
 commIdentVariable = new commercialDetailsWindow();
 PopUpManager.addPopUp(commIdentVariable, this, false);
 commIdentVariable.addEventListener("OK",commercialCloseHandler)
 commIdentVariable.commercialNameTextID.text = commData.Name;
  //bla bla bla
 
 }
 //Code for Query task and Map are identical to above



I also tried this -- myCommGraphic.symbol = myCommGraphic.attributes.SmallLogo;

That didn't work to.
Tags (2)
0 Kudos
2 Replies
RobertMyers
Deactivated User
Have you tried:
private var zasMarkerPicture:PictureMarkerSymbol = new PictureMarkerSymbol('data.SmallLogo');
0 Kudos
raffia
by
Deactivated User
Thanks so much for your reply.....I honestly dont know how it got fixed, i asked Jason Harris and he kindly fixed it...Regards 🙂
0 Kudos