Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex Tree scrolling goes buggy after adding custom TreeItemRenderer
    primarykey
    data
    text
    <p>I have the follow code - as TreeItemRenderer</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:TreeItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:solar="*"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.containers.Canvas; import mx.containers.VBox; import mx.controls.Alert; import mx.controls.Button; import mx.controls.CheckBox; import mx.controls.Tree; import mx.controls.listClasses.BaseListData; import mx.controls.treeClasses.TreeListData; import mx.core.mx_internal; use namespace mx_internal; protected var buttonBox : VBox; override protected function createChildren() : void { super.createChildren(); setStyle( "verticalAlign", "top" ); this.addEventListener( MouseEvent.CLICK, mouseHandler ); } protected function mouseHandler( event : MouseEvent ) : void { if( data.@buttonsVisible == "true" ) data.@buttonsVisible = "false" else data.@buttonsVisible = "true"; showButtons(); } private function showButtons() : void { if( true ) { if( buttonBox == null ) { buttonBox = new VBox(); buttonBox.setStyle( "verticalGap", 0 ); addChild( buttonBox ); var b1 : Button = new Button(); b1.percentWidth = 100; b1.label = "block"; buttonBox.addChild( b1 ); var b2 : Button = new Button(); b2.percentWidth = 100; b2.label = "block1"; buttonBox.addChild( b2 ); var b3 : Button = new Button(); b3.percentWidth = 100; b3.label = "block"; buttonBox.addChild( b3 ); } } else if( buttonBox != null ) { removeChild( buttonBox ); buttonBox = null; } invalidateSize(); invalidateDisplayList(); } override public function set listData( value : BaseListData ) : void { super.listData = value; if( listData ) { showButtons(); } } override protected function measure() : void { super.measure(); if( buttonBox != null ) { //buttonBox.visible = buttonBox.includeInLayout =( !isOpening &amp;&amp; isOpen ) ; var b : Boolean = false; if( data.@buttonsVisible != null ) b = data.@buttonsVisible == "true"; buttonBox.visible = buttonBox.includeInLayout = b; if( buttonBox.visible ) { buttonBox.y = measuredHeight; measuredHeight += buttonBox.measuredHeight; } } } override protected function updateDisplayList( unscaledWidth : Number, unscaledHeight : Number ) : void { super.updateDisplayList( unscaledWidth, unscaledHeight ); if( buttonBox != null ) { buttonBox.x = 40; buttonBox.setActualSize( unscaledWidth - buttonBox.x, unscaledHeight ); } } ]]&gt; &lt;/fx:Script&gt; &lt;/mx:TreeItemRenderer&gt; </code></pre> <p>The application code is as follow :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"&gt; &lt;fx:Declarations&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;/fx:Declarations&gt; &lt;mx:Tree x="289" y="0" width="377" height="599" labelField="@label" itemRenderer="iRR" variableRowHeight="true"&gt; &lt;mx:dataProvider&gt; &lt;fx:XMLList xmlns=""&gt; &lt;folder state="unchecked" label="Marketing Collateral" isBranch="true" &gt; &lt;folder state="unchecked" isBranch="true" label="Media, PR, and Communications" &gt; &lt;folder state="unchecked" isBranch="false" label="Article Reprint Disclaimers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Articles Reprints" /&gt; &lt;folder state="unchecked" isBranch="false" label="Interviews and Transcripts" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Kits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Releases" /&gt; &lt;folder state="unchecked" isBranch="false" label="Quick Hits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Rep Talking Points" /&gt; &lt;folder state="unchecked" isBranch="false" label="Special Updates" /&gt; &lt;folder state="unchecked" isBranch="false" label="White Papers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Article Reprint Disclaimers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Articles Reprints" /&gt; &lt;folder state="unchecked" isBranch="false" label="Interviews and Transcripts" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Kits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Releases" /&gt; &lt;folder state="unchecked" isBranch="false" label="Quick Hits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Rep Talking Points" /&gt; &lt;folder state="unchecked" isBranch="false" label="Special Updates" /&gt; &lt;folder state="unchecked" isBranch="false" label="White Papers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Article Reprint Disclaimers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Articles Reprints" /&gt; &lt;folder state="unchecked" isBranch="false" label="Interviews and Transcripts" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Kits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Releases" /&gt; &lt;folder state="unchecked" isBranch="false" label="Quick Hits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Rep Talking Points" /&gt; &lt;folder state="unchecked" isBranch="false" label="Special Updates" /&gt; &lt;folder state="unchecked" isBranch="false" label="White Papers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Article Reprint Disclaimers" /&gt; &lt;folder state="unchecked" isBranch="false" label="Articles Reprints" /&gt; &lt;folder state="unchecked" isBranch="false" label="Interviews and Transcripts" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Kits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Press Releases" /&gt; &lt;folder state="unchecked" isBranch="false" label="Quick Hits" /&gt; &lt;folder state="unchecked" isBranch="false" label="Rep Talking Points" /&gt; &lt;folder state="unchecked" isBranch="false" label="Special Updates" /&gt; &lt;folder state="unchecked" isBranch="false" label="White Papers" /&gt; &lt;/folder&gt; &lt;folder state="unchecked" isBranch="true" label="Forms and Applications" &gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;/folder&gt; &lt;folder state="unchecked" isBranch="true" label="Forms and Applications" &gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;/folder&gt; &lt;folder state="unchecked" isBranch="true" label="Forms and Applications" &gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;folder state="unchecked" isBranch="false" label="Applications" /&gt; &lt;folder state="unchecked" isBranch="false" label="Forms" /&gt; &lt;/folder&gt; &lt;/folder&gt; &lt;/fx:XMLList&gt; &lt;/mx:dataProvider&gt; &lt;/mx:Tree&gt; &lt;/s:Application&gt; </code></pre> <ul> <li>The code basically works for a bit but after a few items been opened - it fail, and scrolling becaming buggy. Please help.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload