Posted By

dhjapan on 05/06/08


Tagged

scroll


Versions (?)

MovieClip Scroll V0.1


 / Published in: ActionScript
 

Scrolled Movie Clip : quizz_mc Scroll Bar : sb Scroll Track : dead

  1. // Bof scroll
  2. dead._height = mask._height;
  3. bar._y = dead._y;
  4. sb.onPress = function () {
  5. sb.startDrag(false, sb._x, mask._y, sb._x, mask._y + mask._height - sb._height);
  6. sb.onEnterFrame = function () {
  7. var quizz_mc_height = quizz_mc.getHeight();
  8. var mc_y = mask._y - quizz_mc._y;
  9. var mc_y_max = - Math.round( - mask._y - (quizz_mc_height - mask._height));
  10. var sb_y = sb._y - mask._y;
  11. var sb_y_max = Math.round(mask._height - sb._height);
  12. quizz_mc._y = mask._y - Math.round(sb_y * mc_y_max / sb_y_max);
  13. }
  14. }
  15. sb.onRelease = function () {stopDrag();delete sb.onEnterFrame;}
  16. sb.onReleaseOutside = sb.onRelease;
  17. // Eof scroll
  18. // JUMP TO QUEST : force le scroll jusqu'à la dernière question répondue
  19. function jumpToQuest (quest_y/*:Number*/) {
  20. quizz_mc._y = mask._y - quest_y ; //quizz_mc._y;
  21. var quizz_mc_height = quizz_mc.getHeight();
  22. var mc_y = mask._y - quizz_mc._y;
  23. var mc_y_max = - Math.round( - mask._y - (quizz_mc_height - mask._height));
  24. var sb_y_max = Math.round(mask._height - sb._height);
  25. sb._y = mask._y - Math.round((quizz_mc._y - mask._y)*sb_y_max/mc_y_max);
  26. }

Report this snippet  

You need to login to post a comment.