Select to view content in your preferred language

Compile HelloWorldWidget using MXMLC?

889
6
08-26-2010 11:43 AM
ChuenFeng
New Contributor
I am trying to compile the Flex Viewer 2.0 "HelloWorldWidget" using MXMLC in the SDK.  I am getting the following error messages:

\com\esri\viewer\IBaseWidget.as(94): col: 28 Error: Type was not found or was not a compile-time constant: Map.

    function set map(value:Map):void;

\com\esri\viewer\IBaseWidget.as(95): col: 24 Error: Type was not found or was not a compile-time constant: Map.

    function get map():Map;

I managed to compile and deploy few Flex API 2.0 sample applications but can???t port these applications to widgets.

Your help is highly appreciated!

Jonathan Feng
Tags (2)
0 Kudos
6 Replies
ZahidChaudhry
Occasional Contributor III
I am trying to compile the Flex Viewer 2.0 "HelloWorldWidget" using MXMLC in the SDK.  I am getting the following error messages:

\com\esri\viewer\IBaseWidget.as(94): col: 28 Error: Type was not found or was not a compile-time constant: Map.

    function set map(value:Map):void;

\com\esri\viewer\IBaseWidget.as(95): col: 24 Error: Type was not found or was not a compile-time constant: Map.

    function get map():Map;

I managed to compile and deploy few Flex API 2.0 sample applications but can�??t port these applications to widgets.

Your help is highly appreciated!

Jonathan Feng

I looked at your codes. You need to add the listner first and then you can do the next step. here is what you need to change
[HTML]    <viewer:BaseWidget 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"
                     xmlns:viewer="com.esri.viewer.*"
                             initialize="init()"
                     >
  [/HTML]and then add this function

[HTML]                      protected function init():void{
                          map.addEventListener(MapMouseEvent.MAP_CLICK, onMapClick);
                    }
  [/HTML]

Thanks and i hope it will help

Zahid
0 Kudos
ReneRubalcava
Frequent Contributor II
If that doesn't solve your issue, are you doing compiling via ANT?
0 Kudos
ChuenFeng
New Contributor
Thank you, Zahid,

I did added the listener, still not working.  I am using MXMLC command line, not Flash Builder.

I managed to compiled few Flex 2.0 API applications using MXMLC command line link to the agslib-2.0-2010-06-25.swc library.  These home brewed SWF work just fine at my web site.  I can't compile a widget.  The widget code compiled OK, but won't start at my web site.  I took out the local config file, to unlink agslib-2.0-2010-06-25.swc, and MXMLC searches the /com folder then stopped at IBaseWidget.as.

If this works, I will be able to build applications as well as widgets.

Again, thank you so much for your help!

Jonathan Feng

I am trying to compile the Flex Viewer 2.0 "HelloWorldWidget" using MXMLC in the SDK.  I am getting the following error messages:

\com\esri\viewer\IBaseWidget.as(94): col: 28 Error: Type was not found or was not a compile-time constant: Map.

    function set map(value:Map):void;

\com\esri\viewer\IBaseWidget.as(95): col: 24 Error: Type was not found or was not a compile-time constant: Map.

    function get map():Map;

I managed to compile and deploy few Flex API 2.0 sample applications but can�??t port these applications to widgets.

Your help is highly appreciated!

Jonathan Feng
0 Kudos
ChuenFeng
New Contributor
Thank you Odoe,

I am using MXMLC coomand line only.  I use a local config xml to link agslib-2.0-2010-06-25.swc.  My SWF applications work OK.  However, I can't use this approach to compile a widget. 

One thing I observed was that the ESRI "HelloWorldWidget" SWF is 68K.  The same widget the I compiled from the source code is 364K.  Actually, all my SWF applications are about the same size.  I figure it out that it might have something to do with agslib-2.0-2010-06-25.swc.  I took out the local config xml, now MXMLC is stuck at IBaseWidget.as.

I recalled that there was a flexviewer-1.0.swc in the old SFV.  I can't find the flexviewer swc , nor the developer's guide, in the 2.0 distribution package.

Your help is hightly appreciated.

Jonathan Feng
0 Kudos
BjornSvensson
Esri Regular Contributor
As for Flex Viewer 2 documentation:
The Flex Viewer now has an online presence at http://help.arcgis.com/en/webapps/flexviewer/ and so the documentation is no longer part of the download.  For developers, the content is admittedly thin for the beta, but http://help.arcgis.com/en/webapps/flexviewer/help/index.html#developers/gettingstarted_dev.htm is still a good starting point for Flex developers using the ArcGIS Viewer for Flex 2.
0 Kudos
ChuenFeng
New Contributor
I managed to compile "HelloWorldWidget" using MXMLC command line only.  This thread can be closed now. 

A widget should be compiled as a module and optimized for �??index.mxml.�?� Use the following command line to generate a �??link report�?� and unload links from the widget.

[INDENT]1.Generate the linker report and compile the application:
[INDENT]mxmlc -link-report=report.xml MyApplication.mxml[/INDENT]
2.Compile the module and pass the linker report to the load-externs option:
[INDENT]mxmlc -load-externs=report.xml MyModule.mxml[/INDENT][/INDENT]
Replace the ESRI �??index.swf�?� with your homebrew �??index.swf�?� and replace
the �??HelloWorldWidget.swf�?� as well.   Your �??HelloWorldWidget�?� should be ready for testing at this point. 

I have attached my command line and local config files.   Hopefully, my post can be useful to other developers.

Jonathan Feng
0 Kudos