Welcome to Gaia! :: View User's Journal | Gaia Journals

 
 

View User's Journal

Report This Entry Subscribe to this Journal
Private Log
Cant understand whats wrong >.<
Basically the idea sounds right in my head..
Get the percentage of the scroll bar knob versus the scrollable area on the scrollbar.. Then treat the height of the content to be scrolled as 100% and convert some percentages around.. but it turns out to be a code mess D:



// Offsets defined by refresh
var $offsetA:Number = 0;//$offsetA: is a scrollValue
var $offsetBa:Number = 0;
var $offsetBb:Number = 0;//$offsetBb: is a scrollValueCounter point the percentage revlant to the message boxes
var $offsetCa:Number = 0;
var $offsetCb:Number = 0;
var $offsetD:Number = 0;



var boundsRectangle:Rectangle;
var Enabled:Boolean = false;


this.addEventListener(MouseEvent.MOUSE_DOWN, Scroll_START)
this.addEventListener(Event.ENTER_FRAME,setScroll)
stage.addEventListener(MouseEvent.MOUSE_UP, Scroll_END)

function Scroll_START($pass:Event) {
if (Enabled) {
Top_Layer.slider.startDrag(false, boundsRectangle)
}
}
function Scroll_END($pass:Event) {
if (Enabled) {
Top_Layer.slider.stopDrag()
}
}
function Refresh() {
this.Top_Layer.slider.height = 353 * (this.Top_Layer.height / MovieClip(this.parent).Messages.height)
boundsRectangle = new Rectangle(-0.5,12.8,0,(353 - (this.Top_Layer.slider.height +26)))

$offsetBa = MovieClip(this.parent).Messages.y;
$offsetBb = MovieClip(this.parent).Messages.height;
$offsetCa = this.Top_Layer.slider.y;
$offsetCb = this.Top_Layer.slider.height;
trace(this.Top_Layer.slider.height)
trace(this.Top_Layer.height)
trace(MovieClip(this.parent).Messages.height)
trace(MovieClip(this.parent).Messages.y)
Enabled = true;

}
function setScroll(event:Event) {
if (boundsRectangle) {

$offsetA = (this.Top_Layer.slider.y-$offsetCa) / boundsRectangle.height;
MovieClip(this.parent).Messages.y =(($offsetBb * $offsetA)*-1)
trace($offsetBb)
trace($offsetA)
trace($offsetBb * $offsetA)
trace(($offsetBb * $offsetA)*-1+$offsetBb)
}
}


Sadorath
Community Member
  • [08/21/19 07:56pm]
  • [07/31/19 12:16am]
  • [07/27/19 01:30pm]
  • [07/26/19 06:13pm]
  • [01/06/17 04:13am]
  • [02/27/12 12:07am]
  • [02/24/12 02:24am]
  • [02/20/12 02:53am]
  • [12/07/11 04:02am]
  • [10/27/11 05:54pm]




  • User Comments: [1]
    Ziro Officer
    Community Member





    Sat Feb 26, 2011 @ 04:10am


    Hey.

    Yep, writing your own slider/scrollbar is a mess (especially if you want some flexibility in it)! razz

    __________________
    - Ziro out.


    User Comments: [1]
     
     
    Manage Your Items
    Other Stuff
    Get GCash
    Offers
    Get Items
    More Items
    Where Everyone Hangs Out
    Other Community Areas
    Virtual Spaces
    Fun Stuff
    Gaia's Games
    Mini-Games
    Play with GCash
    Play with Platinum