Hi,
It seems that I can't bind a variable to the verticalScrollPosition
property of my Flex app. 
I want to do it using Cairngorm and my model locator, not sure how
else to have a command scroll my application without breaking the
paradigm and sending another message out that the app is listening to
directly...

Here's a simple example that has 1 button setting a bound variable
(doesn't work) and another button setting the property directly (works):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" width="100%" 
         verticalScrollPosition="{scrollPos}"
        height="100%">
        <mx:Script>
                <![CDATA[
                        [Bindable]
                        public var scrollPos:int = 0;
                        private function 
setVerticalScrollPosition(pos:int):void{
                                this.verticalScrollPosition=pos;
                        }
                        
                        private function setScrollPos(pos:int):void{
                                this.scrollPos = pos;
                        }

                ]]>
        </mx:Script>
        <mx:DataGrid y="48.65" width="496" height="2000" horizontalCenter="-1">
        
                <mx:columns>
                        <mx:DataGridColumn headerText="Column 1" 
dataField="col1"/>
                        <mx:DataGridColumn headerText="Column 2" 
dataField="col2"/>
                        <mx:DataGridColumn headerText="Column 3" 
dataField="col3"/>
                </mx:columns>
        </mx:DataGrid>
        <mx:Button x="648" y="2026" label="Change the bound variable"
click="setScrollPos(0)"/>
        <mx:Button x="848" y="2026" label="Change the property directly"
click="setVerticalScrollPosition(0)"/>
        <mx:Label x="112" y="10" text="Scroll to the bottom of this page"
width="360" fontWeight="bold" fontSize="14"/>
        
</mx:Application>


Thanks,
Jack

Reply via email to