flash cs4 - Soft scroll with ActionScript 3.0 -


i'm noob trying develop first site flash. made scrollers, aren't smooth...

the code used was:

const scrollupper:int = -151; const scrolllower:int = 366; const scrollrange:int = scrolllower - scrollupper; var dragbounds:rectangle = new rectangle(scroller_mc.x, scrollupper, 0, scrollrange);  var viewableheight:int = 545; var textupper:int = text_mc.y; var textlower:int = textupper + text_mc.height; var textrange:int = text_mc.height - viewableheight;  scroller_mc.addeventlistener(mouseevent.mouse_down, startscrolling); stage.addeventlistener(mouseevent.mouse_up, stopscrolling); stage.addeventlistener(event.mouse_leave, stopscrolling); stage.addeventlistener(event.deactivate, stopscrolling);  function scroll(e:event = null){ const pctmoved:number = 1 - (dragbounds.bottom - scroller_mc.y) / dragbounds.height; text_mc.y = textupper - (pctmoved * textrange); }  function startscrolling(event:mouseevent):void{ addeventlistener(event.enter_frame, scroll); scroller_mc.startdrag(true, dragbounds); }  function stopscrolling(event:event = null):void{ removeeventlistener(event.enter_frame, scroll); scroller_mc.stopdrag(); } 

the scrollers works, smooth! in advance, please excuse english error, ok?

thanks

marcus

check frame rate. if it's low (like 12 fps) increasing 30 or 60 fps might help.

else might scroll() function called on every enter_frame event. do?


Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -