When the verticalScrollBar moves down(BY code),the items change.
But when it moves up(by code),the items don't change.
And the list cann't work as its usual way.

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> You did not specify what the problem is.  Please provide more detail.
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of duzengqiang
> Sent: Monday, April 21, 2008 8:46 PM
> To: [email protected]
> Subject: [flexcoders] List Renderer error
>
>
>
> I use list.verticalScrollPosition to control items position.
> But it does not work well.
> Please help me.
>
> Here is the source:
> <?xml version="1.0"?>
> <!-- Simple example to demonstrate the List Control -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> ">
>
> <mx:Script>
> <![CDATA[
> import mx.controls.listClasses.ListBase;
> import mx.core.UIComponent;
>
> private var speed:Number = 0;
>
> private function onEnterFrame(e:Event):void{
>
> var target:ListBase = e.currentTarget as ListBase;
> var pos:Number = target.verticalScrollPosition + speed;
> //trace(target.verticalScrollPosition + speed +' '+
> target.maxVerticalScrollPosition);
> if( pos <= 0 ){
> target.verticalScrollPosition = 0;
> }else if( pos >= target.maxVerticalScrollPosition){
> target.verticalScrollPosition =
> target.maxVerticalScrollPosition;
> }else{
> target.verticalScrollPosition = pos;
> }
>
> }
>
> private function onMouseMove(e:MouseEvent):void{
> e.stopPropagation();
> var target:ListBase = e.currentTarget as ListBase;
> var p:Point = new Point( e.localX, e.localY );
> p = source.globalToLocal( p );
> //speed = p.y - target.height / 2;
> trace(e.localY)
> //speed =( e.localY - 100 )/10;
> //trace(speed)
> }
>
> private function onMouseOut(e:MouseEvent):void{
> speed = 0;
> }
>
> ]]>
> </mx:Script>
> <mx:Model id="mystates">
> <states>
> <state label="0" data="AL"/>
> <state label="1" data="AL"/>
> <state label="2" data="AL"/>
> <state label="3" data="AL"/>
> <state label="4" data="AL"/>
> <state label="5" data="AL"/>
> <state label="6" data="AL"/>
> <state label="7" data="AL"/>
> <state label="8" data="AL"/>
> <state label="9" data="AL"/>
> <state label="10" data="AL"/>
> <state label="11" data="AL"/>
> <state label="12" data="AL"/>
> <state label="13" data="AL"/>
> <state label="14" data="AL"/>
> <state label="15" data="AL"/>
> <state label="16" data="AL"/>
> <state label="17" data="AL"/>
> <state label="18" data="AL"/>
> <state label="19" data="AL"/>
> <state label="20" data="AL"/>
> <state label="21" data="AL"/>
> <state label="22" data="AL"/>
> <state label="23" data="AL"/>
> <state label="24" data="AL"/>
> <state label="25" data="AL"/>
> <state label="26" data="AL"/>
> <state label="27" data="AL"/>
> <state label="28" data="AL"/>
> <state label="29" data="AL"/>
> <state label="30" data="AL"/>
> <state label="31" data="AL"/>
> <state label="32" data="AL"/>
> <state label="33" data="AL"/>
> <state label="34" data="AL"/>
> <state label="35" data="AL"/>
> <state label="36" data="AL"/>
> <state label="37" data="AL"/>
> <state label="38" data="AL"/>
> <state label="39" data="AL"/>
> <state label="40" data="AL"/>
> <state label="41" data="AL"/>
> <state label="42" data="AL"/>
> <state label="43" data="AL"/>
> <state label="44" data="AL"/>
> <state label="45" data="AL"/>
> <state label="46" data="AL"/>
> <state label="47" data="AL"/>
> <state label="48" data="AL"/>
> <state label="49" data="AL"/>
> <state label="50" data="AL"/>
> <state label="51" data="AL"/>
> <state label="52" data="AL"/>
> <state label="53" data="AL"/>
> <state label="54" data="AL"/>
> <state label="55" data="AL"/>
> <state label="56" data="AL"/>
> <state label="57" data="AL"/>
> <state label="58" data="AL"/>
> <state label="59" data="AL"/>
> <state label="60" data="AL"/>
> <state label="61" data="AL"/>
> <state label="62" data="AL"/>
> <state label="63" data="AL"/>
> <state label="64" data="AL"/>
> <state label="65" data="AL"/>
> <state label="66" data="AL"/>
> <state label="67" data="AL"/>
> <state label="68" data="AL"/>
> <state label="69" data="AL"/>
> <state label="70" data="AL"/>
> <state label="71" data="AL"/>
> <state label="72" data="AL"/>
> <state label="73" data="AL"/>
> <state label="74" data="AL"/>
> <state label="75" data="AL"/>
> <state label="76" data="AL"/>
> <state label="77" data="AL"/>
> <state label="78" data="AL"/>
> <state label="79" data="AL"/>
> </states>
> </mx:Model>
>
> <mx:Panel title="List Control Example" height="772" width="892"
> paddingTop="10" paddingBottom="10" paddingLeft="10"
> paddingRight="10" layout="absolute">
>
> <mx:List id="source" width="100%" color="blue" height="200"
> dataProvider="{mystates.state}" verticalScrollPolicy="on"
> enterFrame="onEnterFrame(event)"
> mouseMove="onMouseMove(event)"
> mouseOut="onMouseOut(event)" x="10" y="34"
> liveScrolling="true"/>
> <mx:Button x="10" y="254" label="MoveUp" width="286"
> mouseOver="speed = - 0.5" mouseOut="onMouseOut(event)"/>
> <mx:Button x="304" y="254" label="MoveDown" width="286"
> mouseOver="speed = 0.5" mouseOut="onMouseOut(event)"/>
> </mx:Panel>
> </mx:Application>
>


Reply via email to