Hi,
I am sorry if this is a repeat question. have read through the
articles time and again from the adobe docs and some posts in this
forum, but could not resolve my issue.

My class extends a VBox and I try to create components in it. To
simplify and debug the issue, got down to only creating a simple hbox
inside the class and adding a button to it. So the steps are

1. create a class which extends vbox.
2. override createChildren method and set the height, width, and other
styles of the vbox and then call super.createChildren()

3. create a new HBox inside the createChildren method and then add a
button to it.I am setting the verticalScrollPolicy and
horizontalScrollPolicy to off, inside the createChildren method before
calling addchild.

On doing this I always see the horizontal scrollbar enabled. How do we
debug such an issue. i traced through the code and found that the
width and the height of the hbox is much lesser than the height and
width of the vbox.  Is there any reason why this should be happening.

I also implemented the commitProperties method and I tried setting the
properties for the hbox in there but that did not help either.

the code is as shown below. i am working on getting the layout right
for quiet a while without any luck. so please gurus of flex help me
out here.


/****************************************************************/


package edu.csula.cairngorm_emulator.view.fileupload
{
        
        import mx.collections.ArrayCollection;
        import mx.containers.HBox;
        import mx.containers.VBox;
        import mx.controls.Button;
        
        public class TestCoreVocabCompAS extends VBox
        {


                private var _coreContainer:HBox = new HBox();

                public function TestCoreVocabCompAS():void
                {
                        super();
                }


                public function get coreContainer():HBox
                {
                        return this._coreContainer;
                }

                public function set  coreContainer(coreContainer:HBox):void
                {
                        this._coreContainer = coreContainer;
                }

        override protected function createChildren():void {

                            this.width = 228;
                            this.height = 130;
                            this.setStyle("verticalGap", "0");
                            this.setStyle("verticalScrollPolicy", "off");
                            this.setStyle("horizontalScrollPolicy", "off");
                                this.setStyle("horizontalAlign", "center");
                            this.setStyle("verticalAlign", "middle");
                            this.setStyle("paddingTop", 0);
                                this.setStyle("paddingBottom", 0);
                            this.creationPolicy = "all";

                            super.createChildren();
                trace ("this height = " + this.height);
                trace ("this width = " + this.width);

        // set the poperties of the hbox         
         if(this._coreContainer != null)
                                {
                //set the styles.
                                        
this._coreContainer.setStyle("paddingLeft", "2.0");
                                        
this._coreContainer.setStyle("paddingRight", "2.0");
                                        
this._coreContainer.setStyle("verticalScrollPolicy", "off");
                                
this._coreContainer.setStyle("horizontalScrollPolicy", "off");
                                        this._coreContainer.explicitHeight = 93;
this._coreContainer.width = 200;
                                        //set the properties
this.addChild(_coreContainer);

trace ("_coreContainer height = " + this._coreContainer.height);
trace ("_coreContainer widtd = " + this._coreContainer.width);

//add the child components
                if(this.img != null)
                {
                var button:Button = new Button();
                                                 
this._coreContainer.addChild(button);
button.percentHeight = 100;
button.width = 94;
trace ("button height = " + button.height);
trace ("button widtd = " + button.width);
                                                this.img.percentHeight = 100;
this.img.width = 94;
}

        

        
        }

                // Implement the commitProperties() method.
                override protected function commitProperties():void {
                    super.commitProperties();
                                        
this._coreContainer.setStyle("paddingLeft", "2.0");
                                        
this._coreContainer.setStyle("paddingRight", "2.0");
                                        
this._coreContainer.setStyle("verticalScrollPolicy", "off");
                                
this._coreContainer.setStyle("horizontalScrollPolicy", "off");



                }

                

Reply via email to