Error #1009: Cannot access a property or method of a null object reference.

4317
7
Jump to solution
11-14-2012 04:30 AM
TristanKnowlton
Occasional Contributor II
After compiling my project and running the flex viewer, all of the widgets work except for one.  With one particular widget, I am geitting a WidgetManager.mxml error.  I get this error message:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.esri.viewer.managers::WidgetManager/createWidget()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_COPY\s            rc\com\esri\viewer\managers\WidgetManager.mxml:407]
at com.esri.viewer.managers::WidgetManager/runWidget()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_COPY\src\            com\esri\viewer\managers\WidgetManager.mxml:457]
at com.esri.viewer.managers::WidgetManager/widgetReadyHandler()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_             COPY\src\com\esri\viewer\managers\WidgetManager.mxml:525]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ModuleInfoProxy/moduleEventHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ModuleInfo/readyHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::FlexModuleFactory/update()
at mx.core::FlexModuleFactory/docFrameHandler()
at mx.core::FlexModuleFactory/docFrameListener()

Any ideas?  This widget will compile properly on another users computer and in fact that user provide a functioning swf file for me using the exact same code.  I've loaded a fresh flex viewer project, updated software, made sure the flex sdk is the same as the other user's.  I'm not sure what else to do.

Thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
TristanKnowlton
Occasional Contributor II
Thanks for the suggestions.  And Rhett, I did modify the file paths. 

It turns out the widget was originally built in Flash Builder application version 4.6 and I was trying to compile with 4.0.0.  Once I installed 4.6 the widget works properly.  Seems odd to me but it works for now 🙂

View solution in original post

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   Things to check:

  1. Are you both using the same AGS Flex API?

  2. Are you both using the same Adobe Flex SDK (you have already said yes to this)?

  3. Do you both have the same SWCs in your libs folder?

0 Kudos
TristanKnowlton
Occasional Contributor II
Thanks for the suggestions Robert.  We are using same AGS flex api, Adobe Flex SDK, and have the same swcs in our folders.  I tried importing his entire project into my Flash Builder and compiled and still have the same problem.  I also created a blank Flex module and copied the code into it and that did not work either.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   And you have that particular widget added to your project as a module right? Do you see the whateverthewidgetnameis.swf in your bin-debug folder?
0 Kudos
TristanKnowlton
Occasional Contributor II
Yes I do.  I have cleaned the project as well.  I am wits end I believe.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   It is going to be something simple... Is the spelling and the path of the widgets .swf and .xml correct in the main config.xml (make sure you check closely each letter)?
0 Kudos
RhettZufelt
MVP Frequent Contributor
After compiling my project and running the flex viewer, all of the widgets work except for one.  With one particular widget, I am geitting a WidgetManager.mxml error.  I get this error message:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.esri.viewer.managers::WidgetManager/createWidget()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_COPY\s            rc\com\esri\viewer\managers\WidgetManager.mxml:407]
at com.esri.viewer.managers::WidgetManager/runWidget()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_COPY\src\            com\esri\viewer\managers\WidgetManager.mxml:457]
at com.esri.viewer.managers::WidgetManager/widgetReadyHandler()[LOCAL_PATH\Flex_Workspace\FlexViewer_3\FlexViewer_             COPY\src\com\esri\viewer\managers\WidgetManager.mxml:525]


Not sure if this has anything to do with it, or if you modified the error message for privacy, but in all the null object reference errors I have "created", I have never seen it listed as [LOCAL_PATH\ and, I noticed some spaces in /s rc/com and /src/ com/ that have never been reported in my errors.

also, as Robert said, make sure you check letter by letter, especially if you are using the web server built into 10.1.  I just converted a flexapp to 10.1 yesterday and noticed that:

on IIS7   icon="assets/images/legend32.png" or icon="assets/images/Legend32.png" will work.
with AGS10.1, only this works icon="assets/images/legend32.png" (my legend32.png file is NOT Legend32.png).

R_
0 Kudos
TristanKnowlton
Occasional Contributor II
Thanks for the suggestions.  And Rhett, I did modify the file paths. 

It turns out the widget was originally built in Flash Builder application version 4.6 and I was trying to compile with 4.0.0.  Once I installed 4.6 the widget works properly.  Seems odd to me but it works for now 🙂
0 Kudos