Hi all,

I am getting run-time errors in strange situations and was wondering if
anyone might be able to provide some insight as to what is going on.

If I try to attach a "resize" event handler to the Application class,
and refer to other components within the application, I end up getting
run-time errors (but only when using the debug version of the flash
player), e.g.:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical" resize="myPanel.title='TEST'">
     <mx:Panel id="myPanel" width="200" height="200" />
</mx:Application>

The above compiles fine, but when executing with the debug flash player
the following error message results:

An ActionScript error has occurred:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
     at test/___test_Application1_resize()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.core::UIComponent/dispatchEvent()
     at mx.core::UIComponent/dispatchResizeEvent()
     at mx.core::UIComponent/setActualSize()
     at mx.managers::SystemManager/initializeTopLevelWindow()
     at
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::d\
ocFrameHandler()
     at mx.managers::SystemManager/docFrameListener()

If I try to do the same thing using a different event-hanlder (e.g.
click), however, it works fine.

I thought that maybe this was caused by the resize() handler being
executed as soon as the application loaded, perhaps before it had
finished loading all of the components, however, if this were so, the
panel in the above example should display "TEST" right away, which it
does not.

Any ideas?

The application actually behaves fine in both the debug and non-debug
flash players, but I would like to know what is going on.

Thanks,
Keith



Reply via email to