1
votes

I just upgrade from Flex 4.5 to Flex 4.6 and the app was working perfectly with Flex 4.5, but keep getting an error when it runs in Flex 4.6.

It is this bit throw the error, loginPopup is a SkinnablePopupContainer

protected function init(event:FlexEvent):void
{
    loginPopup = new LoginPopup();      
    loginPopup.currentState = "Start";
    loginPopup.open(UIComponent(FlexGlobals.topLevelApplication),true); -- This line throws the error
}

And the error is:

[SWF] TDMAPP.swf - 7,212,792 bytes after decompression

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIndex() at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_getChildIndex()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2187] at mx.managers::SystemRawChildrenList/getChildIndex()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemRawChildrenList.as:181] at spark.components.supportClasses::StyleableStageText/getFormIndex()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1956] at spark.components.supportClasses::StyleableStageText/findTopmostForm()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1933] at spark.components.supportClasses::StyleableStageText/updateProxyImageForTopmostForm()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:2172] at spark.components.supportClasses::StyleableStageText/commitProperties()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1510] at mx.core::UIComponent/validateProperties()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8219] at mx.managers::LayoutManager/validateClient()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:957] at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:382] at mx.managers::PopUpManager$/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManager.as:193] at spark.components::SkinnablePopUpContainer/open()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnablePopUpContainer.as:450] at views::Login/init()[C:\Users\Adobe Flash Builder 4.7\TDMAPP\src\views\Login.mxml:50] at views::Login/___Login_View1_initialize()[C:\Users\Adobe Flash Builder 4.7\TDMAPP\src\views\Login.mxml:5] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] at mx.core::UIComponent/set processedDescriptors()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1871] at mx.core::UIComponent/initializationComplete()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7670] at mx.core::UIComponent/initialize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7649] at spark.components::View/initialize()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\View.as:999] at views::Login/initialize() at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495] at mx.core::UIComponent/addChildAt()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199] at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628] at spark.components::Group/addElementAt()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1387] at spark.components::Group/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1345] at spark.components::SkinnableContainer/addElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:761] at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:2018] at spark.components::ViewNavigator/http://www.adobe.com/2006/flex/mx/internal::createTopView()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1981] at spark.components::ViewNavigator/http://www.adobe.com/2006/flex/mx/internal::setActive()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:424] at spark.components::TabbedViewNavigator/commitProperties()[E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\TabbedViewNavigator.as:741] 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:783] at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

Does anyone know how to solve this?

1
loginPopup.open(this,true); ?user1901867

1 Answers

1
votes

Just solved this by putting this bit of code in the APPLICATION_COMPLETE event rather than the CREATION_COMPLETE event of the view. It looks like the creation order is a bit different in Flex 4.6

Hope that helps.