1 Reply Latest reply on Jul 7, 2009 2:07 PM by xfer_rdy

    trackSkinClass is null with extended Slider

    xfer_rdy

      Hi,

       

      I'm still having problems with extending this slider. I'm past the point of the compiler liking the code. But, I have a runtime is failing during the creation of the trackSkinClass. It thinks the trackSkinClass is null.

       

      Any help is appreciated..

       

         private function createBackgroundTrack():void
          {
              if (!track)
              {
                  var trackSkinClass:Class = getStyle("trackSkin");

       

                  track = new trackSkinClass();

       

                  if (track is ISimpleStyleClient)
                      ISimpleStyleClient(track).styleName = this;

       

                  innerSlider.addChildAt(DisplayObject(track),0);
              }
          }

       

      Stack:

      Main Thread (Suspended: TypeError: Error #1007: Instantiation attempted on a non-constructor.)   
          mx.controls.sliderClasses::Slider/createBackgroundTrack   
          mx.controls.sliderClasses::Slider/createChildren   
          mx.core::UIComponent/initialize   
          mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded   
          mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded   
          mx.core::Container/addChildAt   
          mx.core::Container/addChild   
          mx.core::Container/createComponentFromDescriptor   
          mx.core::Container/createComponentsFromDescriptors   
          mx.core::Container/createChildren   
          mx.core::UIComponent/initialize   
          mx.core::Container/initialize   
          mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded   
          mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded   
          mx.core::Container/addChildAt   
          mx.core::Container/addChild   
          mx.core::Container/createComponentFromDescriptor   
          mx.core::Container/createComponentsFromDescriptors   
          mx.core::Container/createChildren   
          mx.core::UIComponent/initialize   
          mx.core::Container/initialize   
          ViewSelectorRenderer/initialize  

        • 1. Re: trackSkinClass is null with extended Slider
          xfer_rdy Level 1

          Found my own solution....

           

          It turns out I needed to define the following in the class extention:

           

          [DefaultBindingProperty(source="value", destination="labels")]

           

          [DefaultTriggerEvent("change")]

           

          [IconFile("VSlider.png")]

           

              public function SliderX()
              {
                  super();

           

                  direction = SliderDirection.VERTICAL; /* THIS HERE !!! */
              }