我只是从Flex 4.5升级到Flex 4.6,该应用程序与Flex 4.5完美配合,但在Flex 4.6中运行时仍然出现错误。
这就是抛出错误,loginPopup是一个SkinnablePopupContainer
protected function init(event:FlexEvent):void
{
loginPopup = new LoginPopup();
loginPopup.currentState = "Start";
loginPopup.open(UIComponent(FlexGlobals.topLevelApplication),true); -- This line throws the error
}
错误是:
[SWF] TDMAPP.swf - 7,212,792 bytes after decompression
ArgumentError:错误#2025:提供的DisplayObject必须是调用者的子级。 在flash.display :: DisplayObjectContainer / getChildIndex() 在mx.managers :: SystemManager / http://www.adobe.com/2006/flex/mx/internal :: rawChildren_getChildIndex()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \经理\ SystemManager.as:2187] 在mx.managers :: SystemRawChildrenList / getChildIndex()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ SystemRawChildrenList.as:181] 在spark.components.supportClasses :: StyleableStageText / getFormIndex()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ supportClasses \ StyleableStageText.as:1956] 在spark.components.supportClasses :: StyleableStageText / findTopmostForm()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ supportClasses \ StyleableStageText.as:1933] 在spark.components.supportClasses :: StyleableStageText / updateProxyImageForTopmostForm()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ supportClasses \ StyleableStageText.as:2172] 在spark.components.supportClasses :: StyleableStageText / commitProperties()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ supportClasses \ StyleableStageText.as:1510] 在mx.core :: UIComponent / validateProperties()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:8219] 在mx.managers :: LayoutManager / validateClient()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ LayoutManager.as:957] 在mx.managers :: PopUpManagerImpl / addPopUp()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ PopUpManagerImpl.as:382] 在mx.managers :: PopUpManager $ / addPopUp()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ PopUpManager.as:193] 在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] 在flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() 在mx.core :: UIComponent / dispatchEvent()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:13152] 在mx.core :: UIComponent / set processedDescriptors()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:1871] 在mx.core :: UIComponent / initializationComplete()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:7670] 在mx.core :: UIComponent / initialize()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:7649] 在spark.components :: View / initialize()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ View.as:999] 在views :: Login / initialize() 在mx.core :: UIComponent / http://www.adobe.com/2006/flex/mx/internal :: childAdded()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \芯\ UIComponent.as:7495] 在mx.core :: UIComponent / addChildAt()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:7199] 在spark.components :: Group / addDisplayObjectToDisplayList()[E:\ dev \ 4.y \ frameworks \ projects \ spark \ src \ spark \ components \ Group.as:2037] 在spark.components :: Group / http://www.adobe.com/2006/flex/mx/internal :: elementAdded()[E:\ dev \ 4.y \ frameworks \ projects \ spark \ src \ spark \组件\ Group.as:1628] 在spark.components :: Group / addElementAt()[E:\ dev \ 4.y \ frameworks \ projects \ spark \ src \ spark \ components \ Group.as:1387] 在spark.components :: Group / addElement()[E:\ dev \ 4.y \ frameworks \ projects \ spark \ src \ spark \ components \ Group.as:1345] 在spark.components :: SkinnableContainer / addElement()[E:\ dev \ 4.y \ frameworks \ projects \ spark \ src \ spark \ components \ SkinnableContainer.as:761] 在spark.components :: ViewNavigator / createViewInstance()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ ViewNavigator.as:2018] 在spark.components :: ViewNavigator / http://www.adobe.com/2006/flex/mx/internal :: createTopView()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \部件\ ViewNavigator.as:1981] 在spark.components :: ViewNavigator / http://www.adobe.com/2006/flex/mx/internal :: setActive()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \组件\ ViewNavigator.as:424] 在spark.components :: TabbedViewNavigator / commitProperties()[E:\ dev \ 4.y \ frameworks \ projects \ mobilecomponents \ src \ spark \ components \ TabbedViewNavigator.as:741] 在mx.core :: UIComponent / validateProperties()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ core \ UIComponent.as:8219] 在mx.managers :: LayoutManager / validateProperties()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ LayoutManager.as:597] 在mx.managers :: LayoutManager / doPhasedInstantiation()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ LayoutManager.as:783] 在mx.managers :: LayoutManager / doPhasedInstantiationCallback()[E:\ dev \ 4.y \ frameworks \ projects \ framework \ src \ mx \ managers \ LayoutManager.as:1180]
有谁知道如何解决这个问题?
答案 0 :(得分:1)
通过将这些代码放在APPLICATION_COMPLETE事件而不是视图的CREATION_COMPLETE事件中解决了这个问题。看起来Flex 4.6中的创建顺序有点不同
希望有所帮助。