0
votes

If the planets are not correctly aligned when I run a Flex 3.5 build, the .swf produced immidiatly throws a null-object error from the _MyAppWatercherSetupUtil:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at _MyAppWatcherSetupUtil/setup()
    at MyApp/initialize()[/Users/wolever/my_app/MyApp.mxml:0]
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2131]
    at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3400]
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3223]
    at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3069]

Is there anything I can do about this?

I've tried debugging it, but it seems like the Flex framework goes out of its way to make sure it's impossible to debug into the generated code…

4
Any chance of seeing how you are doing your binding? It looks like your binding expression has something which isn't created when it's getting evaluated. - Gregor Kiddie
This is the application's main MXML file, so a bunch of binding is going on. And what do you mean by “binding expression has something which isn't created when it's getting evaluated”? (it's possible, I'm just not sure I understand) - David Wolever
@David I dug into the code some to see what could be going on with that error but nothing obvious is jumping out at me, you can link the open source code to your swc then put breakpoints in there (ctrl+alt+t in eclipse to open based on Class name) then see exactly what's wrong on that line, the line in question is 2131: IUIComponent(child).initialize(); // calls child.createChildren() so if the child at that point is null or is not a IUIComponent I could understand the error, why that is happening is a puzzle. - shaunhusain
@David Also have you tried with other versions of the SDK, any change in results? Also one more do you have dependencies on other swcs compiled against different versions of the SDK or anything along those lines (although this isn't the same error we received when mixing 3.2 and 3.4 we did have issues caused by this, due to strange mojo Flex uses to resolve classes from dependencies). - shaunhusain
@shaunhusain I've tried stepping through with the debugger, but with only limited success. Breaking at the IUIComponent(child).initialize(), everything looks kosher (child is an instance of MyApp, IIRC), but tracing execution any further become difficult as there is no debugging information available for the gen'd code. - David Wolever

4 Answers

2
votes

I just upgraded an old Flex 3 app to Flex 4.6 and had the same problem. What worked for me was a project clean. So far so good.

--Keith

1
votes

I was struggeling today with a WatcherSetupUil/setup() TypeError: Error #1009: Cannot access a property or method of a null object reference.

For me it looks there is a strong connection to databinding. For me it looks this happens if you do not take care of the rules that Flex asks for. I found a resource online I upload here: "Flex data binding pitfalls: 10 common misuses and mistakes." After changing - in my case especially error 6 - Using the wrong bindable event name - took the WatcherSetupUtil away.

Perhaps this is helpful for you too :-). http://www.adobe.com/devnet/flex/articles/databinding_pitfalls.html

0
votes

It would be interesting to have a glimpse at generated code for "setup" method for your MyAppWatcherSetupUtil class

0
votes

Just an idea - did you try to set the compiler flag -keep? Like this you may have a look how your class looks like.