3 Replies Latest reply on Jan 18, 2010 8:10 PM by Benoitcn

    Error while select or over the menubar first time ~

    Benoitcn Level 1

      I have a lot of codes in the main.mxml, so I cut most of them.

      And I don't use the any kinds of the css styles.The code is actually created by FlashCatalyst.

      The menubar dosen't have the skinclass property so I is added manually.

       

      I have attached the main.mxml.  Thanks a lot !

       

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


      <s:Application xmlns:ATE="http://ns.adobe.com/ate/2009"
            xmlns:ai="http://ns.adobe.com/ai/2009"
            xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"
            xmlns:d="http://ns.adobe.com/fxg/2008/dt"
            xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:lib="assets.graphics.transation.*"
            xmlns:flm="http://ns.adobe.com/flame/2008"
            backgroundColor="#ffffff"
            height="100%" preloaderBaseColor="#ffffff"
            width="100%"  creationComplete="application1_creationCompleteHandler(event)"
            xmlns:mx="library://ns.adobe.com/flex/halo">
      <fx:Script>
        <![CDATA[
         import mx.collections.XMLListCollection;
         import mx.events.FlexEvent;
        
         [Bindable]
         private var MenuBarDataList:XMLListCollection;
        
         private var MenuBarData:XMLList=
          <>
           <menuitem label="Menu1">
            <menuitem label="MenuItem 1-A" data="1A"/>
            <menuitem label="MenuItem 1-B" data="1B"/>
           </menuitem>
           <menuitem label="Menu2">
            <menuitem label="MenuItem 2-A" type="check"  data="2A"/>
            <menuitem type="separator" />
            <menuitem label="MenuItem 2-B" >
             <menuitem label="SubMenuItem 2-B-A" type="radio"
              groupName="2one" data="2-B-A"/>
             <menuitem label="SubMenuItem 2-B-B" type="radio"
              groupName="2one" data="2-B-B"/>
            </menuitem>
           </menuitem>
           <menuitem label="Menu3">
            <menuitem label="MenuItem 3-A" type="check"  data="3A"/>
            <menuitem type="separator" />
            <menuitem label="MenuItem 3-B" >
             <menuitem label="SubMenuItem 3-B-A" type="radio"
              groupName="3one" data="3-B-A"/>
             <menuitem label="SubMenuItem 3-B-B" type="radio"
              groupName="3one" data="3-B-B"/>
            </menuitem>
           </menuitem>
          </>;

       

      protected function application1_creationCompleteHandler(event:FlexEvent):void
         {
          MenuBarDataList = new XMLListCollection(MenuBarData);
         }

       

      ]]

      </fx:Script>

       

         <s:Group>

       

           <mx:MenuBar id="topNavMenu" includeIn="main" x="518" y="25.95" height="22"
                dataProvider="{MenuBarDataList}" labelField="@label" />


      </s:Group>

      </s:Application>

       

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.controls::Menu/updateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framework\sr c\mx\controls\Menu.as:1372]
      at mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\pro jects\framework\src\mx\controls\listClasses\ListBase.as:3969]
      at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:663]
      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:736]
      at mx.managers::LayoutManager/validateNow()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\managers\LayoutManager.as:794]
      at mx.controls::Menu/show()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls \Menu.as:1697]
      at mx.controls::MenuBar/showMenu()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\c ontrols\MenuBar.as:1877]
      at mx.controls::MenuBar/mouseDownHandler()[E:\dev\gumbo_beta2\frameworks\projects\framework\ src\mx\controls\MenuBar.as:2070]

        • 1. Re: Error while select or over the menubar first time ~
          Benoitcn Level 1

          Does anybody know why the error come from the border which in the updateDisplayList

           

          override protected function updateDisplayList(unscaledWidth:Number,
                                                            unscaledHeight:Number):void
              {
                  super.updateDisplayList(unscaledWidth, unscaledHeight);

           

                  border.move(0, 0); // error born here
                  border.visible = (dataProvider != null && dataProvider.length > 0);

           

           

           

          TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at mx.controls::Menu/updateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framework\sr c\mx\controls\Menu.as:1372]
          at mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:3 969]
          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:663]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
          at mx.managers::LayoutManager/validateNow()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:794]
          at mx.controls::Menu/show()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\Menu.as:1697]
          at mx.controls::MenuBar/showMenu()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\MenuBar.as:1877]
          at mx.controls::MenuBar/mouseDownHandler()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\MenuBar.as:2070]

          • 2. Re: Error while select or over the menubar first time ~
            Peter deHaan Level 4

            @Benoitcn,

             

            I'm not seeing any errors when using the following code:

             

            <?xml version='1.0' encoding='UTF-8'?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           creationComplete="application1_creationCompleteHandler(event);">
                
                <fx:Script>
                    <![CDATA[
                        import mx.collections.XMLListCollection;
                        import mx.events.FlexEvent;
                        
                        [Bindable]
                        private var MenuBarDataList:XMLListCollection;
                        
                        private var MenuBarData:XMLList=
                            <>
                             <menuitem label="Menu1">
                              <menuitem label="MenuItem 1-A" data="1A"/>
                              <menuitem label="MenuItem 1-B" data="1B"/>
                             </menuitem>
                             <menuitem label="Menu2">
                              <menuitem label="MenuItem 2-A" type="check"  data="2A"/>
                              <menuitem type="separator" />
                              <menuitem label="MenuItem 2-B" >
                               <menuitem label="SubMenuItem 2-B-A" type="radio"
                                groupName="2one" data="2-B-A"/>
                               <menuitem label="SubMenuItem 2-B-B" type="radio"
                                groupName="2one" data="2-B-B"/>
                              </menuitem>
                             </menuitem>
                             <menuitem label="Menu3">
                              <menuitem label="MenuItem 3-A" type="check"  data="3A"/>
                              <menuitem type="separator" />
                              <menuitem label="MenuItem 3-B" >
                               <menuitem label="SubMenuItem 3-B-A" type="radio"
                                groupName="3one" data="3-B-A"/>
                               <menuitem label="SubMenuItem 3-B-B" type="radio"
                                groupName="3one" data="3-B-B"/>
                              </menuitem>
                             </menuitem>
                            </>;
                        
                        protected function application1_creationCompleteHandler(event:FlexEvent):void
                        {
                            MenuBarDataList = new XMLListCollection(MenuBarData);
                        }
                        
                    ]]>
                </fx:Script>
                
                <s:Group>
                    <mx:MenuBar id="topNavMenu" x="518" y="25.95" height="22"
                                dataProvider="{MenuBarDataList}" labelField="@label" />
                </s:Group>
                
            </s:Application>
             
            

             

             

            Are you still seeing the error if you change to the latest nightly Flex 4.0 build? http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

             

            Peter

            • 3. Re: Error while select or over the menubar first time ~
              Benoitcn Level 1

              Yes, but I think I found the problem.

               

              The workflow is Illustrator -> Flash Catalyst -> Flash Builder with Gumbo

               

              If I put up the project on the Tomcat using BlazeDS, the error come out !

               

               

               

               

              在2010-01-19?04:48:24,"Peter?deHaan?(Adobe)"?<forums@adobe.com>?写道:

              >@Benoitcn,

              >?

              >I'm?not?seeing?any?errors?when?using?the?following?code:

              >?

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

              ><s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"

              >???????????????xmlns:s="library://ns.adobe.com/flex/spark"

              >???????????????xmlns:mx="library://ns.adobe.com/flex/mx"

              >???????????????creationComplete="application1_creationCompleteHandler(event);">

              >????

              >????<fx:Script>

              >????????<![CDATA[

              >????????????import?mx.collections.XMLListCollection;

              >????????????import?mx.events.FlexEvent;

              >????????????

              >????????????[Bindable]

              >????????????private?var?MenuBarDataList:XMLListCollection;

              >????????????

              >????????????private?var?MenuBarData:XMLList=

              >????????????????<>

              >?????????????????<menuitem?label="Menu1">

              >??????????????????<menuitem?label="MenuItem?1-A"?data="1A"/>

              >??????????????????<menuitem?label="MenuItem?1-B"?data="1B"/>

              >?????????????????</menuitem>

              >?????????????????<menuitem?label="Menu2">

              >??????????????????<menuitem?label="MenuItem?2-A"?type="check"??data="2A"/>

              >??????????????????<menuitem?type="separator"?/>

              >??????????????????<menuitem?label="MenuItem?2-B"?>

              >???????????????????<menuitem?label="SubMenuItem?2-B-A"?type="radio"

              >????????????????????groupName="2one"?data="2-B-A"/>

              >???????????????????<menuitem?label="SubMenuItem?2-B-B"?type="radio"

              >????????????????????groupName="2one"?data="2-B-B"/>

              >??????????????????</menuitem>

              >?????????????????</menuitem>

              >?????????????????<menuitem?label="Menu3">

              >??????????????????<menuitem?label="MenuItem?3-A"?type="check"??data="3A"/>

              >??????????????????<menuitem?type="separator"?/>

              >??????????????????<menuitem?label="MenuItem?3-B"?>

              >???????????????????<menuitem?label="SubMenuItem?3-B-A"?type="radio"

              >????????????????????groupName="3one"?data="3-B-A"/>

              >???????????????????<menuitem?label="SubMenuItem?3-B-B"?type="radio"

              >????????????????????groupName="3one"?data="3-B-B"/>

              >??????????????????</menuitem>

              >?????????????????</menuitem>

              >????????????????</>;

              >????????????

              >????????????protected?function?application1_creationCompleteHandler(event:FlexEvent):void

              >????????????{

              >????????????????MenuBarDataList?=?new?XMLListCollection(MenuBarData);

              >????????????}

              >????????????

              >????????]]>

              >????</fx:Script>

              >????

              >????<s:Group>

              >????????<mx:MenuBar?id="topNavMenu"?x="518"?y="25.95"?height="22"

              >????????????????????dataProvider=""?labelField="@label"?/>

              >????</s:Group>

              >????

              ></s:Application>

              >?

              >

              >?

              >?

              >Are?you?still?seeing?the?error?if?you?change?to?the?latest?nightly?Flex?4.0?build??http://opensource.adobe.com/wiki/display/flexsdk/DownloadFlex4

              >?

              >Peter

              >