6 Replies Latest reply on Mar 19, 2012 6:42 AM by lee704

    ActionScript Error on MenuBar click event after migrating to Flex 4.5.1

    lee704 Level 1

      Now that I have converted my app to Flex 4.5.1, a MenuBar click event throws the following error:


      TypeError: Error #2007: Parameter child must be non-null.

                at flash.display::DisplayObjectContainer/getChildIndex()

                at mx.core::Container/getChildIndex()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\core\Contai ner.as:2839]

                at mx.containers::ViewStack/set selectedChild()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\containers\ViewStack.as:639]

                at com.views::publicCanvas/mouseClick()[C:\ColdFusion9\wwwroot\ifq2\src\com\views\publicCanv as.mxml:54]

                at com.views::publicCanvas/__menuBar_click()[C:\ColdFusion9\wwwroot\ifq2\src\com\views\publi cCanvas.mxml:86]


      The function throwing the error is:


      private function mouseClick(event:MouseEvent):void


                var tempMenu:MenuBarItem=MenuBarItem(event.target)


                if (XMLList(tempMenu.data).*.length() == 0)






      The ViewStack is defined as:


      <mx:ViewStack id="publicViewStack"








                <!-- selectedIndex = 0 -->


                          <views:publicHomeCanvas id="publicHomeCanvas"/>




                <!-- selectedIndex = 1 -->


                          <views:viewDealers id="viewDealers"/>





      The menu data is defined in the menuDataPublic.as file as:


      <?xml version="1.0" encoding="UTF-8"?>




                <item position="top" label="Home" view="publicHomeCanvas" menuindex="0" />


                <item position="top" label="View Dealers" view="viewDealers" menuindex="1" />




      In 3.6, this worked perfectly.  Under 4.5.1 it fails as indicated.  Has anyone run into a similar problem?


      Thank again!