2 Replies Latest reply on Jul 15, 2009 10:29 AM by xfer_rdy

    How does derived class access mx_internal namespace ?

    xfer_rdy

      Hi,

       

      I've been struggling with the PopUpButton for a day now.. Just trying to move the popup location. Since I can't get moving the PopUpButton into my directory and have it find the icons, I'm attempting to subclass PopUpButton.

       

      Some of the methods in PopUpButton  are defined as mx_internal. I cannot seem to access the methods during runtime. I get an error:

       

      Main Thread (Suspended: TypeError: Error #1006: value is not a function.)
      ViewControl/clickHandler

      I can compile the code, prefixing the specific function with "mx_internal."

       

      Here is the code:

      package {
      import flash.events.Event;
      import flash.events.FocusEvent;
      import flash.events.KeyboardEvent;
      import flash.events.MouseEvent;
      import mx.core.mx_internal;
      import mx.controls.PopUpButton;

      use namespace mx_internal;

      public class ViewControl extends PopUpButton
      {
        public function ViewControl(state:String = ViewSelectorState.TILE, value:Number=0):void
        {
         super();
         /* Add the popup */
         _renderer = new ViewSelectorRenderer();
        
         super.popUp = _renderer;
        
        }
       
        /* override the click */
          override protected function clickHandler(event:MouseEvent):void
          {
           if (overArrowButton(event))
           {
              if (mx_internal.isShowingPopUp())
               mx_internal.closeWithEvent(event);
              else
               mx_internal.openWithEvent(event);

              event.stopImmediatePropagation();
           }
           else
           {
              super.clickHandler(event);
              if (openAlways)
              {
               if (mx_internal.isShowingPopUp())
                  mx_internal.closeWithEvent(event);
               else
                  mx_internal.openWithEvent(event);      
              }  
           }
          }
      }