actionscript 3 - Sticky header on elements in VBox -


i have vbox container elements in it. vbox has limited height , enables scrolling if elements exceed height.

each of child elements have "header" element. in case of scrolling, header element visible if container "clipped" scrolling, iphone contacts application (see this question behavior described, headers correspond a, b, etc.). have bottom element should behave similarly, sticking bottom of visible area of canvas.

i have been trying accomplish listening on mouse events detect scrolling , manually correct position of header , bottom elements this:

private function updatetopbottomposition():void {     var host:displayobjectcontainer = owner;      var global0:point = host.localtoglobal(new point(0, 0));     var global1:point = host.localtoglobal(new point(host.width, host.height));      //transform parent global coordinates local frame     var local0:point = this.globaltolocal(global0);     var local1:point = this.globaltolocal(global1);      var maxtop:number = this.height;     var minbottom:number = this.height; // - toplabel.height      var top:number = local0.y;     top = math.max(0, top);     top = math.min(this.height, top);      toplocaldistance = top;      var bottom:number = this.height - local1.y;     bottom = math.max(0, bottom);     bottom = math.min(this.height, bottom);      bottomlocaldistance = bottom;      if(prevbottomlocaldistance == bottomlocaldistance && toplocaldistance == prevtoplocaldistance)         return;      prevbottomlocaldistance = bottomlocaldistance;     prevtoplocaldistance = toplocaldistance;      //while there changes, try again     settimeout(updatetopbottomposition, 1); } 

it work okay, , have uploaded source code complete working prototype here.

unfortunately, user experience approach bad; components not move fluently , positioning not update correctly.

i have not been able find component or approach able achieve effect in question seamlessly. grateful if point me in direction of able solve problem.

perhaps i've misuderstood, reason can't use additional layout of nesting?

container  - header container  - vbox scroller 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -