Flex 4.6 -- how to debug runtime errors

I'm teaching myself Adobe Flex 4.6 (FlashBuilder) and am picking up the coding method fine, but having trouble when I hit a runtime error.

For example, I have an app on a tabbed control that has a datagrid on each tab pulling MySQL data for display.  Rather than having all this code in the main file, I created separate components for each datagrid and dropped them into each tab.

Everything worked fine until I converted the last datagrid display into a component and put it on the top tab and removed the corresponding code in the main file.  That grid displays properly, but now when I click on any of the other tabs to show those grids I get the following runtime error:

ReferenceError: Error #1065: Variable _Componenets_teacherGridWatcherSetupUtil is not defined.
      at global/flash.utils::getDefinitionByName()
      at Componenets::teacherGrid()[C:\Users\Gary\Adobe Flash Builder 4.6\FlexPHPMysqlUpdateAdv\src\Componenets\teacherGrid.mxml:4]
      at mx.core::Container/createComponentFromDescriptor()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:4294]
      at mx.core::Container/createComponentsFromDescriptors()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:4183]
      at mx.core::Container/createDeferredContent()[E:\dev\4.y\frameworks\projects\mx\src\mx\core\Container.as:4214]
      at mx.containers::ViewStack/instantiateSelectedChild()[E:\dev\4.y\frameworks\projects\mx\src\mx\containers\ViewStack.as:1260]
      at mx.containers::ViewStack/commitProperties()[E:\dev\4.y\frameworks\projects\mx\src\mx\containers\ViewStack.as:756]
      at mx.containers::TabNavigator/commitProperties()[E:\dev\4.y\frameworks\projects\mx\src\mx\containers\TabNavigator.as:566]
      at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8219]
      at mx.managers::LayoutManager/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:813]
      at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

Not sure how to begin debugging this and any help on this specific error, or on runtime debugging in Flex would be appreciated.


Who is Participating?
ProactivationConnect With a Mentor Commented:
I don't know if I'm being too obvious, so forgive me if I am, but have you tried using the Debug feature in Flash Builder?  It's whole purpose is to debug runtime errors, and drops into the Debug perspective whenever it encounters any, letting you see which line caused the problem and the values of any variables concerned. If the problem is in a library and it doesn't have access to the source then things are more complicated, but it's fine for your own code.

To "avoid" runtime errors, you should wrap any code that's prone to throw runtime errors (IO, file, etc) in a try/catch block, and handle the problem properly rather than simply suppressing any errors.
gdejarnettAuthor Commented:
Following up, I found that the problem was that I didn’t have the as3corelib in my build path.

I'm not getting this error now, but if I could get some good advice on how to debug runtime errors here, I'll still award the points.

Also if there are any Flashbuilder settings I should change (that are not already set by default) to avoid runtime errors, please let me know.


gdejarnettAuthor Commented:
Thanks for the suggestion.

Yes, I do use the debugger, but my problem is that when I would run it before deploying, it would run cleanly.

I'll look more into the try/catch blocks though and see if I can bring it to the surface that way.

Thanks again for taking the time to help,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.