Friday, 15 July 2011

actionscript 3 - AS3: On scroll tween alpha to last children inside scrollPane with dynamic content -



actionscript 3 - AS3: On scroll tween alpha to last children inside scrollPane with dynamic content -

i trying alter alpha of lastly children within scrollpane component create overflowed objects dissapear instead of cutted scrollpane. mean, closest kid top or bottom it's alpha gonna closer zero. if between margins alpha equal 1;

i set "header" , "footer" transparent sprites scrollpane in order have blanck space alpha effect , had no problem doing top elements, here code:

function scrolllistener(event:scrollevent):void { var base of operations = 120;//margins height var targ = event.currenttarget.getchildat(3).getchildat(0);//get container var scrolly = event.currenttarget.verticalscrollposition;//get scroll position (var n1 = 0; n1 < 10; n1++) {// loop children var curr = targ.getchildbyname("boton"+n1);// current children name var var curr_disp = curr.y-scrolly; curr.alpha = 1;//default alpha if(curr_disp < base){//if y inferior margin (var base) var alfa = ((curr_disp)/base)/2; curr.alpha = alfa; } } }; sp.addeventlistener(scrollevent.scroll, scrolllistener);

i need same in bottom if kid @ bottom border of scrollpane it's alpha gets equal 0 , if kid @ bottom minus 120 (the var 'base') alpha equal 1. lost , deadline over. hope 1 give me advice.

sorry bad english. in advance.

actionscript-3 math components

No comments:

Post a Comment