Avoiding a Flex 4 error when using PopUpManager.addPopUp()

There is a problem in Flex 4 when you using the PopUpManager’s addPopUp() method to create a pop up that has a Spark container parent. This problem was reported in a JIRA bug: SDK-25082. If you call addPopUp(), you will get the runtime error:

Error: removeChild() is not available in this class. Instead, use removeElement() or modify the skin, if you have one.
at spark.components::Group/removeChild()

Unfortunately, we didn’t have time to fix this bug in the Flex 4 time frame. So, the bug was deferred. However, there is a pretty simple workaround for the bug. In your code, you just need to parent the component that you want to pop up with an MX component.

Here are a couple of examples:

Error Example: AddPopUpErrorExample.swf, AddPopUpErrorExample.mxml

Workaround for Error: AddPopUpExample.swf, AddPopUpExample.mxml

If you would like this bug fixed in the future, please go to it and vote on it. Otherwise, this may stay a bug in the framework for all of eternity. 😦

6 responses

  1. hi try to put the popup code inside tag that should do the trick. and you wont get this error any more. 🙂 hope this helps

  2. this didn’t work for me if that’s what you meant.

  3. This error has already been fixed…

  4. this has to be the buggiest language on earth! the errors are misleading and the programming experience with flex is a total cluster @%#$! So tired of Adobe leave a trail of loose ends.

  5. it is not fixed, still present in FLEX SDK 4.5… Workaround is simple if you can afford MX component, but I really need to have spark component as root component of popup 😦

  6. make a skinnable popup container: <s:SkinnablePopUpContainer…..

    put it between your

    open via actionscript

    no more error

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: