Select to view content in your preferred language

Blank Map

2870
9
Jump to solution
02-03-2014 10:44 AM
KeithWeber1
Deactivated User
Hello,

I am brand new to Flex development. I have attempted to run multiple of the samples from https://developers.arcgis.com/flex/sample-code/using-samples.htm but every time I end up with a blank map with the esri logo in the bottom right corner and the +/- zoom buttons in the top left corner. Does anyone have any advice on what I can do to find out what is going on? Here is my source for one of the most basic samples.

<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"       xmlns:s="library://ns.adobe.com/flex/spark"       xmlns:esri="http://www.esri.com/2008/ags"       pageTitle="Example - ArcGIS API for Flex connecting to a dynamic ArcGIS map service">    <esri:Map>   <esri:ArcGISDynamicMapServiceLayer    url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"/>  </esri:Map>   </s:Application>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KeithWeber1
Deactivated User
I figured out the problem. The development machine I am working has Adobe Flash Builder 4.5 installed which, by default, installs Adobe Flex SDKs 3.6, 4.5 and 4.5.1. I had to download Adobe Flex SDK 4.6 and use it. Now everything is working..... Newbie mistake :mad:

View solution in original post

0 Kudos
9 Replies
KomanDiabate
Deactivated User
Are you using chrome? This maybe a chrome issue.
First: try your site with different browser for example: Internet Explorer
Second: If its a chrome issue, check this link:
http://www.timo-ernst.net/2010/04/chrome-flash-debugger-not-connecting-to-flexflash-builder/

I have experience blank maps before this was the solution.
0 Kudos
KeithWeber1
Deactivated User
Koman,

Thanks for the reply. I am using I.E. 9. Unfortunately, I do not have another browser available on this machine and do not have access to install another one. I altered the code a little bit to see if an error is being thrown when the layer is added, but had no luck. Here's the code I changed. I added a button and load the layer in the button click so I could surround it with a try/catch. I was hoping to see an error message but instead I see "Layer Added." yet the map is still blank.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:esri="http://www.esri.com/2008/ags"
      pageTitle="Example - ArcGIS API for Flex connecting to a dynamic ArcGIS map service">
 
 <fx:Script>
  <![CDATA[
   import mx.controls.*;
   import com.esri.ags.layers.*;
   
   protected function button1_clickHandler(event:MouseEvent):void
   {
    try
    {
     var layer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer");
     map.addLayer(layer, 0);
     Alert.show("Layer Added.");
    }
    catch(e:Error)
    {
     Alert.show(e.toString());
    }
   }
  ]]>
 </fx:Script>
 
 
 <esri:Map id="map" x="378" y="81" width="1002" height="590">
  <!--<esri:ArcGISDynamicMapServiceLayer
   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"/>-->
 </esri:Map>
 <s:Button x="133" y="169" label="Button" click="button1_clickHandler(event)"/>
 
</s:Application>
0 Kudos
KomanDiabate
Deactivated User
OK, I used your code and I ended up with a blank map, I think your button click logic is wrong.
I have set the map  visible="false" and then when you click on the button I am setting visible to true and the map loads.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:esri="http://www.esri.com/2008/ags"
      pageTitle="Example - ArcGIS API for Flex connecting to a dynamic ArcGIS map service">
 
 <fx:Script>
  <![CDATA[
   import mx.controls.*;
   import com.esri.ags.layers.*;
   
   protected function button1_clickHandler(event:MouseEvent):void
   {
    try
    {
     /* var layer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer");
     map.addLayer(layer, 0);
     Alert.show("Layer Added."); */ 
     
     map.visible=true;
     Alert.show("Layer Added.");
    }
    catch(e:Error)
    {
     Alert.show(e.toString());
    }
   }
  ]]>
 </fx:Script>
 
 
 <esri:Map id="map" x="378" y="81" width="1002" height="590" visible="false">
  <esri:ArcGISDynamicMapServiceLayer
  url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"/>
 </esri:Map>
 <s:Button x="133" y="169" label="Button" click="button1_clickHandler(event)"/>
 
</s:Application>

0 Kudos
KeithWeber1
Deactivated User
Koman,

Thanks for the update. Using the code you updated, I am still seeing a blank map. It appears to me that the problem is something outside the scope of the code, meaning either something isn't installed or something is being blocked, etc. I am not sure where to begin investigating this. This is my first time working with Flex or Flash Builder. Any ideas?
0 Kudos
KomanDiabate
Deactivated User
Hi Keith,
I actually went back and look at your code again, its working on my end here and this is not a code issue, sorry. I am using explorer, I think something else is going on.
0 Kudos
KomanDiabate
Deactivated User
Keith,
Maybe you need a crossdomain.xml added to the inetput\wwwroot folder? Maybe?
0 Kudos
KeithWeber1
Deactivated User
Koman,

Well I definitely boiled it down to some sort of environment problem. I went home last night and downloaded the trial version of Flash Builder, download the ArcGIS Flex swc file and ran the sample. Everything worked, so there is something going on with this development machine. I am going to ask the admins to reinstall flash builder and see if that resolves the issue. If it doesn't, I have no idea what else to look for because I am not receiving and sort of error message, just a blank map. Thanks for all your help!
0 Kudos
EvelynHernandez
Frequent Contributor
Well im using some examples from that page too and using chrome and i.e at same time.
Sometimes the map in chrome loads so slow and u have to refresh the page 1 or 2 times.
For i.e it works fine.

And the first time when i put a example in the machine that im developing i had to change the chrome:plugins
Adobe Flash Player (2 files) - Versión: 12.0.0.44
2 shockwave flash files to unable and able again and well how i told u before, now chrome loads the map but i have to wait
several minutes for that.

I hope it works for u 🙂
0 Kudos
KeithWeber1
Deactivated User
I figured out the problem. The development machine I am working has Adobe Flash Builder 4.5 installed which, by default, installs Adobe Flex SDKs 3.6, 4.5 and 4.5.1. I had to download Adobe Flex SDK 4.6 and use it. Now everything is working..... Newbie mistake :mad:
0 Kudos