for example:(custom scrollbar)
package
{
        import flash.events.MouseEvent;
        
        import mx.controls.*;
        import mx.controls.scrollClasses.ScrollBar;

        public class MyVScrollBar extends VScrollBar
        {
                private var mBtn:Button;
                public function MyVScrollBar()
                {
                        super();
                }
                override protected function createChildren():void
                {
                        super.createChildren();
                        if(!mBtn)
                        {
                                mBtn = new Button;
                                mBtn.label = "II";
                                this.addChild(mBtn);
                        }
                }
                override protected function updateDisplayList
(unscaledWidth:Number, unscaledHeight:Number):void
                {
                        super.updateDisplayList
(unscaledWidth,unscaledHeight);
                        mBtn.setActualSize
(unscaledWidth,unscaledHeight);
                        mBtn.move(0,0);
                }
        }
}



<mx:Panel id="myPanel" height="400" width="100%" 
verticalScrollBar="new MyScrollBar">
                <mx:Text width="100%" height="500"/>
</mx:Panel>
this is error.
Initializer for 'verticalScrollBar': values of type 
mx.controls.scrollClasses.ScrollBar cannot be represented in text.

in this way:
private var vsb:MyVScrollBar;
private function init():void{
        vsb = new MyVScrollBar;
        Alert.show((vsb is ScrollBar).toString());
        myPanel.verticalScrollBar = vsb;
                                
}
Without the error,but custom scroll can't apply container...


How apply custom scrollbar to a container?thanks



Reply via email to