So finally we are able to dispatch and handle event in custom verticlecolumn
component

Here is how our class look like:
Actionscript code:

public class ResponsiveVerticalColumnLayout extends VerticalColumnLayout
        {
                protected var _minColumnWidth:int;
                protected var baseComponent:UIBase;
                
                public function ResponsiveVerticalColumnLayout() {
                        // set a default value for numColumns
                        super.numColumns = 1;
                }
                
                override public function set strand(value:IStrand):void {
                        super.strand = value;
                        this.baseComponent = UIBase(value);
                        // setup the event handler
                        this.baseComponent.addEventListener("sizeChanged", 
calculateNumColumns);
                }
                
                public function set minColumnWidth(value:int):void {
                        this._minColumnWidth=value;
                }
                
                private function calculateNumColumns(e:Event):void {
                        var width:int = baseComponent.parent.width;
                        this.numColumns = int(width / _minColumnWidth);   // 
truncate
                        
                        if (this.numColumns <= 0) {
                                // prevent numColumns from being set to an 
invalid value
                                this.numColumns=1;
                        }
                }
        }

calling code:

<js:beads>
        <layout:ResponsiveVerticalColumnLayout minColumnWidth="500"/>
</js:beads>

Thanks
Dhwani



--
View this message in context: 
http://apache-flex-development.2333347.n4.nabble.com/FlexJS-extending-VerticalColumnLayout-tp52676p52852.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Reply via email to