Revisiting the Flex whiteBox issue
Posted on April 29, 2007 | Filed Under Adobe Flex, Software Engineering
A few months back, I posted about a hardcoded whiteBox display object in the mx:Container object. I ran into a problem with my workaround after posting about it, but I forgot to post an update on how to deal with it.
I recently received an email from James Polanco at DHAP Digital mentioning the same problem I had run into earlier, namely that an exception would occur when the Flex framework attempted to delete the already deleted whiteBox object.
My solution was to override the mx:Containers rawChildren_removeChild(…) method and verify the child that was being deleted actually existed before attempting to delete it. I consider this to be good defensive coding and something that should’ve been done in the first place. Here’s my code for that:

However, James proposed a simpler solution to the problem: Hiding the whiteBox object instead of deleting it. Then you avoid the problem caused by attempting to delete a non-existent object altogether. Great idea James! Thank you for taking the time to email me about it.
So, the old “more than one way to skin a cat” adage is once again proven to be true. You can rid yourself of the whiteBox issue by deleting it, then protecting against faulty deletion attempts, or you can use the simpler solution of hiding it as James suggested.
Regardless of the solution you choose, you should consider overriding the rawChildren_removeChild(…) method as I did and protecting against faulty deletion attempts. It’s bound to happen sooner or later and that will be one less problem to deal with when the time comes.
About this Post
Permalink | Trackback |
|
Print This Article |
Comments
7 Responses to “Revisiting the Flex whiteBox issue”
Leave a Reply
Thanks for taking the time to post the original in the first place. I found myself handed a bug with this issue and after playing around with the code for a bit I figured I may as well see if anyone else had the same trouble. You saved me a lot of hassle and that is always appreciated, thanks again!!
Thank you for this great work around.
Apparently i have some newb questions, since i am a newb.
Isnt this will be alot easier if we simply edit the code under flex source folder container.as file?
I like to getrid of the whitebox in oneshot for all the container components including the application. Since application is also a container.
Can this be a good approach?
Best Regards
AliTan
Hey AliTan,
I wouldn’t recommend editing the source. I’ll outline why I wouldn’t, then you can decide whether or not it’s the right solution for you.
First, if you edit the source, this will require rebuilding the Flex Framework libraries (.SWC files). You can see a list of them in the “Library Path” tab of your project properties’ “Flex Build Path” option.
Second, you will always have to maintain your changes and rebuild the libraries every time Adobe releases a new version of the Flex framework. Since they’ve made the Flex framework an open-source project, new releases will probably occur a lot more frequently than they have in the past.
Third, the forthcoming Flex 3 introduces the ability for the Flash player to cache libraries across multiple Flex applications worldwide. Your apps won’t take advantage of the globally cached framework files because you’ll be using your own custom version of the Flex framework. It will only mean a one-time download of your customized framework, but still…
Finally, both solutions offered by myself and James are most likely temporary band-aids. I have a support contract with Adobe and corresponded directly with Adobe Flex engineers regarding the issue. I fully expect this issue will no longer exist in Flex 3 when it is released by year’s end.
Thanks for your comment!
TommyB
Hey TommyB,
Thank you so much for your reply.
Point taken!
AliTan
It seems like the problem still in there for Flex3.

Since it is still there in Flex 3, I logged a bug (overriding each container in your app isn’t a good solution):
https://bugs.adobe.com/jira/browse/SDK-15597
Hey guys, sorry to hear it wasn’t fixed. I’d imagine it was a matter of priorities. Since it was a cosmetic issue that can be worked around, it wouldn’t be the first thing to get fixed.
There is another way to fix it globally. I have created a new post that describes the technique here.