Runtime error with new 3.4 API

1233
13
Jump to solution
07-30-2013 07:51 AM
IsaiahAguilera
Occasional Contributor II
Can anyone explain why I get these errors when running a mobile application with the new 3.4 api. 

Class mx.controls:: DateField could not be found.

Class com.esri.ags.skins.fieldClasses::CalendarField could not be found.


I can have a completely blank mobile project and add a simple.
<esri:Map id="map"> </esri:Map>

And these errors come up when running a simulation.  Comment out the map portion and they go away. These run errors seem to go away if I switch back to the 3.3 esri api also.  I'm not sure if i'm missing something but this usually works right out of the box so I am a bit baffled.  Any help would be great thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
I found a solution for 3.4. Instead of changing the PopUpRendererSkin, you need to change the AttributeInspectorSkin. The change is to update it so that it isn't using the CalendarField. Here's an example where I've set it to use a TextField instead. I then saved this to my app's "skins" package/folder.

        <fx:Component id="dateField">             <!--<fieldClasses:CalendarField dateFormat="shortDate" useUTC="false"/>-->             <fieldClasses:TextField minWidth="200"/>         </fx:Component>


You then have to override two styles in a file named "defaults.css" that tells Flex to use your customized AttributeInspectorSkin. The defaults.css file must be in the root of your src folder.

defaults.css:
@namespace esri "http://www.esri.com/2008/ags";  esri|AttributeInspector, esri|RelationshipInspector #attributeInspector {     skinClass: ClassReference("skins.AttributeInspectorSkin"); }


Test app:
<?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"                applicationDPI="160">      <esri:Map id="map">     </esri:Map>  </s:Application>

View solution in original post

0 Kudos
13 Replies
DasaPaddock
Esri Regular Contributor
You'll need to add a reference to the mx.swc. See:
https://developers.arcgis.com/en/flex/guide/mobile-flex.htm
0 Kudos
IsaiahAguilera
Occasional Contributor II
You'll need to add a reference to the mx.swc. See:
https://developers.arcgis.com/en/flex/guide/mobile-flex.htm


Thanks for you help Dasa!

I was wondering if I needed to do that but I have not needed to do this with the 3.3 API and I am not using any MX components either.  Is the new 3.4 API dependent on the mx.swc?

Also when I do add the mx.swc and the sparkskins.swc like you suggested, simply adding a map component again gives me 5 warnings as shown in the picture.  Is there any way to remove these warnings?  Again this is a blank project with just a map component added so far.
[ATTACH=CONFIG]26323[/ATTACH]

Thanks for your help!
0 Kudos
DasaPaddock
Esri Regular Contributor
The other option mentioned at the bottom of that link is to remove references to the RelationshipInspector in the PopUpRendererSkin. The RelationshipInspector uses the AttributeInspector which by default, uses mx components like DateField. This has been an issue since 3.1, but now with 3.4, you're getting the error right away.
0 Kudos
IsaiahAguilera
Occasional Contributor II
Thanks Dasa!
I understand now.  To do this, do I just grab a copy of the skin from the api download and then comment out any thing in the PopUpRendererSkin.mxml that references the RelationshipInspector?  I think I am missing something because I am still getting the error.  Is there more involved then what I am doing?

Thanks,
0 Kudos
IsaiahAguilera
Occasional Contributor II
The other option mentioned at the bottom of that link is to remove references to the RelationshipInspector in the PopUpRendererSkin. The RelationshipInspector uses the AttributeInspector which by default, uses mx components like DateField. This has been an issue since 3.1, but now with 3.4, you're getting the error right away.


Ive changed everything I can think of in the PopUpRendererSkin and I cannot get the runtime error to go away. I know I am probably missing something or not even doing it the right way but I can't get it working.  I would hate to switch to the older api but that might be my only option for now.  Any help would be appreciated.
0 Kudos
DasaPaddock
Esri Regular Contributor
I found a solution for 3.4. Instead of changing the PopUpRendererSkin, you need to change the AttributeInspectorSkin. The change is to update it so that it isn't using the CalendarField. Here's an example where I've set it to use a TextField instead. I then saved this to my app's "skins" package/folder.

        <fx:Component id="dateField">             <!--<fieldClasses:CalendarField dateFormat="shortDate" useUTC="false"/>-->             <fieldClasses:TextField minWidth="200"/>         </fx:Component>


You then have to override two styles in a file named "defaults.css" that tells Flex to use your customized AttributeInspectorSkin. The defaults.css file must be in the root of your src folder.

defaults.css:
@namespace esri "http://www.esri.com/2008/ags";  esri|AttributeInspector, esri|RelationshipInspector #attributeInspector {     skinClass: ClassReference("skins.AttributeInspectorSkin"); }


Test app:
<?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"                applicationDPI="160">      <esri:Map id="map">     </esri:Map>  </s:Application>
0 Kudos
IsaiahAguilera
Occasional Contributor II
Thanks for spending so much time on this Dasa!

I made the specified changes and I was still getting an error.  So I did some digging and found that I had to also change the AttributeTableSkin and the RelationshipInspectorAttributeInspectorSkin.  I was still getting an error so I just went looking for the calendar field in any file and it was in those two also. 

 <fx:Component id="dateField">
        <!--<fieldClasses:CalendarField/> -->
   <fieldClasses:TextField minWidth="200"/>
        </fx:Component>



I wasn't sure how to reference the RelationshipInspectorAttributeInspectorSkin in the default.css so I just made a com.esri.ags.skins package and put them all in there to bypass the css and it got rid of my runtime errors.  Did I do something wrong that I had to change those two files as well? I am not using those components at all I am just running the basic map still.
<ns:Map id="map">
  
 </ns:Map>


Anyways I am able to use everything either way now. I was just curious about the other two skins ans why I had to change those also.

Thanks,
0 Kudos
DasaPaddock
Esri Regular Contributor
I only had to make the changes I showed in my previous reply.

Did you name the css file default.css or defaults.css?

I also found in testing, that just changing the css file doesn't trigger a rebuild, so I had to either do a clean or make a small edit to the mxml to force a rebuild.
0 Kudos
IsaiahAguilera
Occasional Contributor II
That was it. I used "default" instead of "defaults". Renaming it and running a clean made it all work.  Thanks for all of your help with this.  It is very appreciated.
0 Kudos