How to tab vertically instead of horizontally - actionscript-3

I am working in Flex and trying to get a sparks datagrid to tab vertically instead of horizontally.
var hBox:HBox = new HBox();
var templateDataGrid:spark.components.DataGrid = new spark.components.DataGrid();
templateDataGrid.dataProvider = dataGridList;
templateDataGrid.columns = columnHeaders;
templateDataGrid.sortableColumns = false;
templateDataGrid.editable = true;
hBox.addElement(templateDataGrid);
Have a pretty simple as3 implementation that I am rendering inside a HBox.
Here is a full working example from the API, I am writing my grid in as3 not mxml, but i can translate.
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Panel title="Spark DataGrid Control Example which demonstrates the variableRowHeight and rowHeight properties"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0">
<s:controlBarContent>
<s:HGroup verticalAlign="baseline">
<s:CheckBox label="variableRowHeight={dataGrid.variableRowHeight}" selected="#{dataGrid.variableRowHeight}"/>
<s:Label text=" "/> <!-- blank space -->
<s:HSlider minimum="12" maximum="120" value="#{dataGrid.grid.rowHeight}"/>
<s:Label text="rowHeight={dataGrid.grid.rowHeight}"/>
</s:HGroup>
</s:controlBarContent>
<s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" editable="true">
<s:ArrayCollection>
<s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
<s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
<s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
<s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
<s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
<s:DataItem key="1005" name="File" price="150.05" call="true"/>
<s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
<s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
<s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
<s:DataItem key="1009" name="Jack" price="190.09" call="true"/>
</s:ArrayCollection>
</s:DataGrid>
</s:Panel>
</s:Application>
The grid example can be seen in the api here if you want to see the grid, and see than when you tab it goes horizontally. I want it to go vertically!

Here is what I have so far. It works in that when the person releases the tab key, it looks at where they are, and goes to a different location. (in my case down one.) The built in tab navigation happens on on KEY_DOWN, and this occurs on the KEY_UP. So the selected item bounces around which may not be the best. This works where for GridSelectionMode.SINGLE_CELL.
myGrid.addEventListener(KeyboardEvent.KEY_UP, selectionChangingHandler);
private function selectionChangingHandler(event:KeyboardEvent):void
{
if(event.keyCode == Keyboard.TAB){
var selectedCell:CellPosition = event.currentTarget.selectedCell;
var columnLength = event.currentTarget.grid.columns.length;
var rowLength = event.currentTarget.grid.dataProvider.length;
var columnIndex:Number = selectedCell.columnIndex;
var rowIndex:Number = selectedCell.rowIndex+1;
if(rowLength == rowIndex){
if(columnIndex == columnLength-1){
columnIndex = 0;
rowIndex = 0;
}else{
columnIndex = columnIndex+1;
rowIndex = 0;
}
}
var success:Boolean = event.currentTarget.startItemEditorSession(rowIndex,columnIndex);
event.currentTarget.setSelectedCell(rowIndex,columnIndex);
}
}

Related

Spark DataGrid selected cell edit on keyDown

I am using spark DataGrid. I want to emulate Excel Behaviour = When single cell is selected and users start to type on keyboard the selected cells goes to editing mode. I did it by starting gridItemEditorSession on 1st keyDown event but the problem I have is that after starting gridItemEditorSession value in the cell is selected so 2nd keyDown removes 1st keyDown character ;/
Here is demo:
Simply select any cell and start typying:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
private function onKeyDown():void
{
trace(dataGrid.grid.anchorRowIndex)
trace(dataGrid.grid.caretRowIndex)
dataGrid.startItemEditorSession(dataGrid.grid.anchorRowIndex, dataGrid.grid.anchorColumnIndex)
}
private function onGridRollOver():void
{
}
]]>
</fx:Script>
<s:DataGrid id="dataGrid" requestedRowCount="5" width="350" editable="true"
height="300" selectionMode="multipleCells" keyDown="onKeyDown()"
gridRollOver="onGridRollOver()">
<s:ArrayCollection>
<s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
<s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
<s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
<s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
<s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
<s:DataItem key="1005" name="File" price="150.05" call="true"/>
<s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
<s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
<s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
<s:DataItem key="1009" name="Jack" price="190.09" call="true"/>
</s:ArrayCollection>
</s:DataGrid>
</s:Application>
I'm not too familair with Flex, but it sounds like you have a string handling issue. Something like
private function handleKeydown(e:KeyboardEvent):void
{
output_txt.text = String.fromCharCode(e.charCode);
}
instead of
private function handleKeydown(e:KeyboardEvent):void
{
output_txt.appendText(String.fromCharCode(e.charCode));
}
Make sure you're appending input to your text instead of replacing.

Disable unselected items in a List After 5 items are selected

Im new to flex development. I have a dynamically data bound list component. I need to restrict user from selecting more than 5 items.
List is made with checkboxes and labels
getSelectionCount() method returns the number of currently selected items.
Here is my code
<s:VGroup width="100%" height="100%">
<s:List id="chkLst" visible="{isMultipleSelectionAllowed}" width="100%" height="100%" borderVisible="false"
fontFamily="segoeui"
dataProvider="{filteredDataSet}" >
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
//-----------------------------------------------
//
// Checkbox select
//
//-----------------------------------------------
protected function chk_clickHandler(event:MouseEvent):void
{
var selection:Array = new Array();
for each(var item:Object in outerDocument.chkLst.dataProvider)
{
selection.push(item);
}
var count:int = 0;
for each(var sItem:Object in selection)
{
outerDocument.setSelectionCount(0);
if(sItem.selected)
{
count++;
}
outerDocument.setSelectionCount(count);
}
Alert.show(outerDocument.getSelectionCount()+"","test");
if(CheckBox(event.target).selected && outerDocument.getSelectionCount() <= 5){
outerDocument.setSelectionCount(outerDocument.getSelectionCount()+1);
}
if(outerDocument.getSelectionCount() >= 6){
}
}
]]>
</fx:Script>
<s:HGroup width="100%" height="30" gap="2" paddingLeft="5" paddingRight="5" verticalAlign="middle" clipAndEnableScrolling="true">
<s:CheckBox id="chk"
label="{data.label}" change="{data.selected = chk.selected}" selected="{data.selected}"
maxWidth="215" click="chk_clickHandler(event)" />
</s:HGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
How can disable the checkboxes which user has not selected when user selection count exceeds 5 ?
2 I also need to enable all check boxes back if user unticks some checks in order that selection count go below 5
Thank You
First you need to add enabled property in your arraycollection like below which also make bindable in itemRenderer enabled="{data.enabled}". If count reach 5 we disable all button except selected one which the help of enabled property and magic here we need to update arraycollection items by using mx.collections.IList.itemUpdated(item:Object, property:Object=null, oldValue:Object=null, newValue:Object=null):void method so that only it will reflect disable the other checkboxes. In our case use outerDocument.chkLst.dataProvider.itemUpdated(item);
Sample arraycollection structure:
<fx:Declarations>
<s:ArrayCollection id="filteredDataSet" >
<fx:Object selected="false" enabled="true" label="one"/>
<fx:Object selected="true" enabled="true" label="two"/>
<fx:Object selected="false" enabled="true" label="three"/>
<fx:Object selected="false" enabled="true" label="four"/>
<fx:Object selected="false" enabled="true" label="five"/>
<fx:Object selected="false" enabled="true" label="six"/>
<fx:Object selected="false" enabled="true" label="seven"/>
<fx:Object selected="false" enabled="true" label="eight"/>
<fx:Object selected="false" enabled="true" label="nine"/>
</s:ArrayCollection>
</fx:Declarations>
<s:List id="chkLst" width="100%" height="100%" borderVisible="false"
fontFamily="segoeui"
dataProvider="{filteredDataSet}" >
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function chk_clickHandler(event:MouseEvent):void
{
data.selected = chk.selected;
var selection:Array = [];
for each(var item:Object in outerDocument.chkLst.dataProvider)
{
if(item.selected)
selection.push(item);
}
if(selection.length>=5)
{
for each(var item:Object in outerDocument.chkLst.dataProvider){
item.enabled = item.selected;
outerDocument.chkLst.dataProvider.itemUpdated(item);
}
}else{
for each(var item:Object in outerDocument.chkLst.dataProvider){
item.enabled = true;
outerDocument.chkLst.dataProvider.itemUpdated(item);
}
}
}
]]>
</fx:Script>
<s:HGroup width="100%" height="30" gap="2" paddingLeft="5" paddingRight="5" verticalAlign="middle" clipAndEnableScrolling="true">
<s:CheckBox id="chk" label="{data.label}" selected="{data.selected}" enabled="{data.enabled}"
maxWidth="215" click="chk_clickHandler(event)" />
</s:HGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>

Flex Column Chart overlay stacking order

I have a column chart in flex that has quite a few columns, the user can choose to display in column order or overlaid. Depending on the users screen it makes the chart more readable.
However, is then any call I can make to have the overlay order change depending on the data. i.e. Largest data column a the back, overlaid by the next largest so on and so fourth until the smallest column is on top.
Currently default behavior some of the small columns are obscured by the larger columns, I don't want to change alpha values to do this. (first of all thanks to flashharry! as
I have seen this question 2-3 times in some discussion forums, but not answered any where). Is this possible in flex column chart???
Any help would be immensely appreciated.
Thanks in advance..
#Serge Him
Code sample:- in the below code the profit of last two months are lesser than expense, so we cannot see the series as it is behind the expense series. I want the greater value will be always behind lesser value
<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">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:2000, Expenses:1500},
{Month:"Feb", Profit:1000, Expenses:200},
{Month:"Mar", Profit:1100, Expenses:500},
{Month:"Apr", Profit:1300, Expenses:900},
{Month:"May", Profit:900, Expenses:1200},
{Month:"June", Profit:1500, Expenses:2500}
]);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:BorderContainer width="100%" height="100%" >
<s:layout>
<s:VerticalLayout horizontalAlign="center"/>
</s:layout>
<mx:ColumnChart id="myChart" width="65%"
dataProvider="{expenses}"
showDataTips="true"
type="overlaid"
>
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{expenses}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries
yField="Profit"
displayName="Profit"
>
<mx:fill>
<s:SolidColor color="0x00ff00"/>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries
yField="Expenses"
displayName="Expenses"
>
<mx:fill>
<s:SolidColor color="0xff0000"/>
</mx:fill>
</mx:ColumnSeries>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{myChart}"/>
<mx:DataGrid dataProvider="{expenses}" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="Month" editable="true"/>
<mx:DataGridColumn dataField="Profit" editable="true"/>
<mx:DataGridColumn dataField="Expenses" editable="true"/>
</mx:columns>
</mx:DataGrid>
</s:BorderContainer>
</s:Application>
I've studied your problem, deeping in initializing ColumnChart component. There is a feature, that all columns from series is placed in separate layer. So, either green columns are on the top or red. No posibility to change parent of one column from series...I'm afraid you have to override the basic behavior of component and place all columns in the same container and sort their depths. I drew an example:
<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" width="900" height="600">
<fx:Script>
<![CDATA[
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:200, Expenses:100, Expenses2:50},
{Month:"Feb", Profit:1000, Expenses:2000, Expenses2:500},
{Month:"Mar", Profit:1100, Expenses:500, Expenses2:100},
{Month:"Apr", Profit:1300, Expenses:900, Expenses2:1000},
{Month:"May", Profit:900, Expenses:1200, Expenses2:1000},
{Month:"June", Profit:1000, Expenses:2000, Expenses2:1500}
]);
private var items:Array = [];
private function init():void
{
items = [];
for (var i:int=0; i<myChart.series.length; i++)
{
var series:ColumnSeries = myChart.series[i] as ColumnSeries;
for (var j:int=0; j<series.items.length; j++)
{
if (!items[j])
items[j] = [];
var item:ColumnSeriesItem = series.items[j] as ColumnSeriesItem;
items[j][i] = item;
series.parent.addChild(item.itemRenderer as DisplayObject);
}
}
sort();
}
private function sort():void
{
var h:Number = myChart.height - 50;
for (var i:int=0; i<items.length; i++)
{
var group:Array = items[i];
group.sort(sortFunction);
for (var j:int=0; j<group.length; j++)
{
var item:ColumnSeriesItem = group[j] as ColumnSeriesItem;
item.itemRenderer.parent.setChildIndex(item.itemRenderer as DisplayObject, group.length - j - 1);
item.min = NaN;
if (j > 0)
item.min = h - group[j-1].itemRenderer.height;
}
}
}
private function sortFunction(item1:ColumnSeriesItem, item2:ColumnSeriesItem):int
{
var yValue1:int = item1.item[Object(item1.element).yField];
var yValue2:int = item2.item[Object(item2.element).yField];
return (yValue1 < yValue2) ? -1 : (yValue1 > yValue2) ? 1 : 0;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:BorderContainer width="100%" height="100%" >
<s:layout>
<s:VerticalLayout horizontalAlign="center"/>
</s:layout>
<mx:ColumnChart id="myChart" width="65%"
dataProvider="{expenses}"
showDataTips="true"
type="overlaid"
updateComplete="init()"
>
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{expenses}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries
yField="Profit"
displayName="Profit"
>
<mx:fill>
<s:SolidColor color="0x00ff00"/>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries
yField="Expenses"
displayName="Expenses"
>
<mx:fill>
<s:SolidColor color="0xff0000"/>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries
yField="Expenses2"
displayName="Expenses2"
>
<mx:fill>
<s:SolidColor color="0xffff00"/>
</mx:fill>
</mx:ColumnSeries>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{myChart}"/>
<mx:DataGrid dataProvider="{expenses}" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="Month" editable="true"/>
<mx:DataGridColumn dataField="Profit" editable="true"/>
<mx:DataGridColumn dataField="Expenses" editable="true"/>
<mx:DataGridColumn dataField="Expenses2" editable="true"/>
</mx:columns>
</mx:DataGrid>
</s:BorderContainer>
</s:Application>

Flex multiple spark lists with scrolling synced

I have several horizontal scrolling lists with differing item widths stacked inside a Vertical Group. On an item click all any selected item from the other lists will be cleared. When any of the lists are scrolled all the other lists should scroll exactly the same amount in the same direction, simalar to http://www.foxsports.com.au/tvguide.
The synced scrolling is throwing an undefined error and has crashed the adl(it is a mobile app) on one occasion. This happens only when I add more than 2 synced scrolling lists via event listeners.
So my question is: Can anyone see why this errors or is there a better way to achieve this type of horizontal scrolling multi-list, possibly a really wide data-grid or group of buttons inside a scroller?
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="view1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.PropertyChangeEvent;
// listen for scroll event
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
list1.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler1);
list2.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler2);
list3.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler3);
}
// scroll all lists together
private function propertyChangeHandler1(evt:PropertyChangeEvent):void
{
var n:Number = Number(evt.newValue);
list2.dataGroup.horizontalScrollPosition = n;
list3.dataGroup.horizontalScrollPosition = n;
}
private function propertyChangeHandler2(evt:PropertyChangeEvent):void
{
var n:Number = Number(evt.newValue);
list1.dataGroup.horizontalScrollPosition = n;
list3.dataGroup.horizontalScrollPosition = n;
}
private function propertyChangeHandler3(evt:PropertyChangeEvent):void
{
var n:Number = Number(evt.newValue);
list2.dataGroup.horizontalScrollPosition = n;
list1.dataGroup.horizontalScrollPosition = n;
}
// on click clear currently selected
protected function listClickHandler(_iList:int, _index:int):void
{
switch(_iList)
{
case 1:
{
list2.selectedIndex = -1;
list3.selectedIndex = -1;
break;
}
case 2:
{
list1.selectedIndex = -1;
list3.selectedIndex = -1;
break;
}
case 3:
{
list2.selectedIndex = -1;
list1.selectedIndex = -1;
break;
}
}
}
]]>
</fx:Script>
<fx:Declarations>
<s:ArrayCollection id="myArrayCollection">
<fx:Object label="FIRST" message="54.99"/>
<fx:Object label="Stapler" message="3.59"/>
<fx:Object label="Printer" message="129.99"/>
<fx:Object label="Notepad" message="2.49"/>
<fx:Object label="Mouse" message="21.79"/>
<fx:Object label="Keyboard" message="32.99"/>
<fx:Object label="Ink" message="54.99"/>
<fx:Object label="Stapler" message="3.59"/>
<fx:Object label="Printer" message="129.99"/>
<fx:Object label="Notepad" message="2.49"/>
<fx:Object label="Mouse" message="21.79"/>
<fx:Object label="Keyboard" message="32.99"/>
<fx:Object label="Ink" message="54.99"/>
<fx:Object label="Stapler" message="3.59"/>
<fx:Object label="Printer" message="129.99"/>
<fx:Object label="Notepad" message="2.49"/>
<fx:Object label="Mouse" message="21.79"/>
<fx:Object label="Keyboard" message="32.99"/>
<fx:Object label="Ink" message="54.99"/>
<fx:Object label="Stapler" message="3.59"/>
<fx:Object label="LAST" message="32.99"/>
</s:ArrayCollection>
</fx:Declarations>
<s:VGroup id="lists" gap="0" left="0" right="0" top="0" bottom="0" width="180%" height="100%" >
<s:List id="list1" width="100%" click="listClickHandler(1, list1.selectedIndex)" horizontalScrollPolicy="on" verticalScrollPolicy="off" selectedIndex="0" dataProvider="{myArrayCollection}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
<s:List id="list2" width="100%" click="listClickHandler(2, list2.selectedIndex)" horizontalScrollPolicy="on" verticalScrollPolicy="off" selectedIndex="0" dataProvider="{myArrayCollection}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
<s:List id="list3" width="100%" click="listClickHandler(3, list3.selectedIndex)" horizontalScrollPolicy="on" verticalScrollPolicy="off" selectedIndex="0" dataProvider="{myArrayCollection}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
</s:VGroup>
</s:View>
Here is the simple way to do it, obviously the lists need to be wider than stage for it to scroll.
<s:Scroller id="sc" horizontalScrollPolicy="on" verticalScrollPolicy="off" width="100%">
<s:VGroup id="lists" gap="0" left="0" right="0" top="0" bottom="0">
<s:List id="list1" horizontalScrollPolicy="off" verticalScrollPolicy="off" dataProvider="{data}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
<s:List id="list2" horizontalScrollPolicy="off" verticalScrollPolicy="off" dataProvider="{data}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
<s:List id="list3" horizontalScrollPolicy="off" verticalScrollPolicy="off" dataProvider="{data}">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
</s:List>
</s:VGroup>
</s:Scroller>
Dont go for Long code,
You can put your two listboxes inside Two scrollviewers and in the scrollviewer's viewChanged event write your code in codebehind.
private void ScrollViewer1_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
ScrollViewer2.ScrollToHorizontalOffset(double.Parse(ScrollViewer1.HorizontalOffset.ToString()));
}
Tested your example on a computer with 4.6 sdk but i see no errors.
Still your code will not work on lists of different size (in this case your lists will scroll only for the smallest list size) .
Also instead of using PropertyChangeEvent on viewport try using Event.CHANGE on scrollBar:
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
list1.scroller.horizontalScrollBar.addEventListener(Event.CHANGE, propertyChangeHandler1);
list2.scroller.horizontalScrollBar.addEventListener(Event.CHANGE, propertyChangeHandler2);
list3.scroller.horizontalScrollBar.addEventListener(Event.CHANGE, propertyChangeHandler3);
}
// scroll all lists together
private function propertyChangeHandler1(evt:Event):void
{
var source = evt.currentTarget as Scroller;
var n:Number = list1.scroller.viewport.horizontalScrollPosition;
list2.dataGroup.horizontalScrollPosition = n;
list3.dataGroup.horizontalScrollPosition = n;
}
private function propertyChangeHandler2(evt:Event):void
{
var n:Number = list2.scroller.viewport.horizontalScrollPosition;
list1.dataGroup.horizontalScrollPosition = n;
list3.dataGroup.horizontalScrollPosition = n;
}
private function propertyChangeHandler3(evt:Event):void
{
var n:Number = list3.scroller.viewport.horizontalScrollPosition;
list2.dataGroup.horizontalScrollPosition = n;
list1.dataGroup.horizontalScrollPosition = n;
}
And if you need to change the scroll programmatically use also FlexEvent.VALUE_COMMIT

reason for error message type was not found or was not a compile time constant:SuperPanel

<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var createdWindows:Number = 0;
private var minimizedWindows:Number = 0;
private var mWindowArray:Array;
private function addPanelHandler(pTitle:String = "SuperPanel ", pWidth:Number = 250, pHeight:Number = 180):void {
this.createdWindows += 1;
var curNum:Number = this.numChildren + 1;
var child:SuperPanel = new SuperPanel();
child.showControls = true;
child.enableResize = true;
child.title = pTitle + curNum;
child.width = pWidth;
child.height = pHeight;
child.x = this.createdWindows * 20;
child.y = this.createdWindows * 20;
this.addChild(child);
}
]]>
</mx:Script>
<mx:Style source="assets/css/styles.css"/>
<mx:Label text="SuperPanel v1.5 component explorer" right="10" top="10"
fontSize="18" fontWeight="bold" fontFamily="Arial" color="#ffffff"/>
<mx:Text width="220" right="10" y="45">
<mx:htmlText>
<![CDATA[<font color="#ffffff" size="14"><b>Features:</b><br />- Drag 'n Drop (on titlebar)<br />- Resize handler<br />- Close button<br />- Open a new panel<br />- Normal/max screen<br />- Give a panel focus</font>]]>
</mx:htmlText>
</mx:Text>
<ext:SuperPanel id="panel01" title="SuperPanel 01"
x="35.5" y="45" width="345" height="180"
layout="absolute" showControls="true" enableResize="true">
</ext:SuperPanel>
<ext:SuperPanel id="panel02" title="SuperPanel 02"
x="361.5" y="264" width="357" height="353"
layout="absolute" showControls="true" enableResize="true">
</ext:SuperPanel>
<mx:Canvas id="minimizedWindowContainer"
width="100%" height="53" bottom="0"
backgroundColor="#efefef"
borderSides="top" borderThickness="3" borderColor="#666666" borderStyle="solid">
<mx:HBox id="mWindowContainer" left="0" right="200" height="100%"/>
<mx:Button right="10" verticalCenter="0" label="Add new SuperPanel" click="this.addPanelHandler()"/>
</mx:Canvas>
In the above flex code there is errors where superpanel is used.the error message is
type was not found or was not a compile time constant:SuperPanel
what will be the reason for these error message?
Possible reasons:
Namespace ext is pointed into wrong package
SuperPanel doesn't exist in that package
Compile error in SuperPanel class
SuperPanel is in the library and this library isn't compiled successfully