actionscript 3 - Playlist scroller mp3 player -


i working on music player , have working playlist, need playlist short if lot of songs added doesn't go off-screen. created mask , scrollbar. song names in playlist, , new ones can added @ given time.

function startdragging2(mouseevent)     {         playlistslider.playlistsliderhandle.startdrag(false,rectangle2);         dragging = true;     }      function stopdragging2(mouseevent)     {         if(dragging)         {             dragging = false;             playlistslider.playlistsliderhandle.stopdrag();         }     }      function adjusty(event)     {         var myy:number = playlistslider.playlistsliderhandle.y;         collectionmc.y = (myy * -collectionmc.numchildren);  <--------     } 

now want make scrollbar handle determines position of parent movieclip contains song names. if scroll down, want go no further amount of songs in list. right scrolls, not enough not whole list shows.

what need simple formula decides y position of parent movieclip relative y position of slider handle.

thanks in advance,

milan.

edit: forgot add, first name @ y:20. second @ y:40. third @ y:60, , forth

edit 2: formula i'm close, can scroll space of 6 names (120 y) far.

var myy:number = playlistslider.playlistsliderhandle.y; collectionmc.y = -(myy * (collectionmc.numchildren / 6)); 

edit 3: have changed height of mask , scrollbar 100 make easier. 5 names can show inside mask. when add 5 songs scrollbar appears, it's not supposed scroll down when use because songs fit inside mask. when add 1 want scroll down enough show 6th name , not see first name. instead scrolls size of mask(100) further down it's supposed to, no matter how many songs add.

edit 4: have found solution. right formula this:

collectionmc.y = (((collectionmc.numchildren - 5) * -0.2) * myy); 

why not use fl's or flex's scrollbar? know people hate me suggesting it, wants simple enough ignore the...unpleasantness. can skin way it!


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -