flash - ensureIndexIsVisible(), scroll to the top of a List control? -


i'm using fb4 , apparently need use ensureindexisvisible() scroll specific item in s:list. anyway, code below scrolls item not scroll top of list (it's @ bottom, , cut off somewhat). there anyway that?

mxml:

<s:list id="schedule" dataprovider="{schedule}" creationcomplete="creationcompletehandler(event)"/> 

as3:

protected function creationcompletehandler(event:event):void {     var d:date = new date();     var today:string = string((d.month + 1) + "/" + d.date + "/" + d.fullyear);     var dp:xmllistcollection = event.currenttarget.dataprovider;     for(var i:uint; < dp.length; i++){         if(dp.child("date")[i] == today){             event.currenttarget.ensureindexisvisible(i);         }     } } 

bad solution, it's work me

var pt:point = list.layout.getscrollpositiondeltatoelement(i); while (pt) {     list.validatenow();     if (pt.y > 0) {         var delta:int = list.layout.getverticalscrollpositiondelta(navigationunit.down);     } else {         delta = list.layout.getverticalscrollpositiondelta(navigationunit.up);     }     list.layout.verticalscrollposition += delta;     pt = list.layout.getscrollpositiondeltatoelement(i); } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -