I am not sure how it is possible that the item has been removed from the
display list. I however take your word for it :) Since you can not put a try
/ catch block (or check) around error area the solutions are limited.

My first thought was to extend the component and override the
thumbReleaseHandler, this method is however most likely private and thus can
not be overridden. You could however try this:

scrollbar.addEventListener(MouseEvent.MOUSE_UP, _listener, false, 1);

function _listener(e:MouseEvent):void
{
   //check if the scrollbar is part of the display list
   if (!scrollbar.stage)
   {
      //It is not in the display list, stop the event from being dispatched
to the default dispatcher
      e.stopImmediatePropagation();
   };
};

In the above code you add a listener that has a higher priority than the
internal listener of the scrollbar. Within the listener you check if the
scrollbar has still has a stage reference (which means it is still part of
the display list).
If it has not, you tell the event dispatcher to stop dispatching the event.

Before you try this code I would urge you to check the setup of your
application as it (usually) should be avoidable to have this error in the
first place.


Greetz Erik


On 1/29/08, Helmut Granda <[EMAIL PROTECTED]> wrote:
>
> I have a scroll component that sometimes is deleted from the display list
> while the user is holding the scroll bar and I get this error:
>
> TypeError: Error #1009: Cannot access a property or method of a null
> object
> reference.
>     at fl.controls::ScrollBar/fl.controls:ScrollBar::thumbReleaseHandler()
>
> We know this error is fired since the scroll component is non-existent by
> the time the user releases the scroll bar...I am trying to catch it but
> not
> sure how should I catch this type of error since this is fired from within
> the component...
>
> I have tried the following:
>
> sp.addEventListener(MouseEvent.MOUSE_UP, catchError);
> sp.addEventListener(MouseEvent.MOUSE_LEAVE, catchError);
>
> and so forth... I am still trying but some suggestions would be great.
>
> Thanks,
> Helmut
> _
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to