2 Replies Latest reply on Aug 11, 2010 8:26 AM by BG Solutions

    CS5 Combobox misbehaving

    BG Solutions

      I’ve got a very simple combobox, 3 data items and an event handler. The catch is that the combobox is in an external swf loaded into the main swf through the loader class (worked fine in CS3 & CS4). Here’s the only AS3 code for the box:

       

      //--------------------------------------------------
      function initControls():void {

           subtitleSelect.addItem({label:"No Subtitles",data:"none"});
           subtitleSelect.addItem({label:"English Subtitles",data:"english"});
           subtitleSelect.addItem({label:"Spanish Subtitles",data:"spanish"});
           subtitleSelect.selectedIndex = 0;
           subtitleSelect.addEventListener(Event.CHANGE,onChangeSubtitle);
      }


      The symptoms are as follows:

       

      When used in an external swf the combobox does not show index 0 (it’s blank) and when clicked throws the following error:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
           at fl.containers::BaseScrollPane/drawBackground()
           at fl.controls::List/draw()
           at fl.core::UIComponent/drawNow()
           at fl.controls::List/scrollToIndex()
           at fl.controls::SelectableList/scrollToSelected()
           at fl.controls::ComboBox/open()
           at fl.controls::ComboBox/onToggleListVisibility()

       

      When the external swf is run independently the box mostly functions, it does not throw an error and properly calls the event listener, however, it does not show the default selected index and when the combobox is changed it does not keep the current selection visible.

       

      This worked perfectly in CS4 & CS3, there’s really nothing complicated about it. I have entirely deleted the old CS components and replaced them with brand new CS5 components, still no luck. Anyone know what’s up?

        • 1. Re: CS5 Combobox misbehaving
          BG Solutions Level 1

          Hmmm … the failure to display the selected index can be corrected by moving the combobox out of a masked layer (did I forget to mention the mask? ;-) … however … it still throws an error when clicked as part of a child swf.

          • 2. Re: CS5 Combobox misbehaving
            BG Solutions Level 1

            Got it.

             

            Mask + Combobox = :-(

             

            To clear the error when used in a child SWF I had to add the component assets to the parent. When I added a temporary combobox to the parent I was given the option to replace existing assets, so apparently somewhere in the parent was an older asset screwing things up. I deleted the temporary combobox in the parent but left the assets, everything works fine.