A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Scroll Bar Issue MX

  1. #1
    Heavyweight Pixel Champion Pixel Puncher's Avatar
    Join Date
    Oct 2002
    Location
    State of Confusion
    Posts
    485

    Scroll Bar Issue MX

    Can someone take a look at the swf file and my code to see why my scrollbar is not staying on the slider? You'll have to navigate through the first part to see what I mean.
    Code:
    // start line-by-line scrolling
    function pressArrow(d) {
    	mode = "scroll";
    	
    	// remember direction
    	amount = d;
    	
    	// do it at least once
    	sbFrame();
    }
    
    // stop scrolling
    function releaseArrow(d) {
    	mode = "none";
    }
    
    // start page-by-page scrolling
    function pressBar() {
    	mode = "page";
    	
    	// remember location of click and compute limit of paging
    	clickLoc = _ymouse;
    	limit = getSlider(_ymouse);
    	
    	// compute number of lines in page
    	amount = (_parent.scrollTextQuote.bottomScroll - _parent.scrollTextQuote.scroll);
    	
    	// scroll the other way?
    	if (clickLoc < slider._y) amount *= -1;
    
    	// do it at least once
    	sbFrame();
    }
    
    // stop paging
    function releaseBar() {
    	mode = "none";
    }
    
    // signal to follow slider
    function pressSlider() {
    	mode = "slide";
    }
    
    // stop following slider
    function releaseSlider() {
    	mode = "none";
    }
    
    // code to perform once per frame
    function sbFrame() {
    	if (mode == "scroll") {
    		// scroll one line
    		_parent.scrollTextQuote.scroll += amount;
    		setSlider();
    
    	} else if (mode == "slide") {
    		// compute new line and scroll to it
    		line = getSlider(_ymouse);
    		_parent.scrollTextQuote.scroll = line;
    		setSlider();		
    		
    	} else if (mode == "page") {
    		// scroll by page
    		_parent.scrollTextQuote.scroll += amount;
    		
    		// stop scrollng when limit reached
    		if (((amount > 0) and (_parent.scrollTextQuote.scroll > limit)) or ((amount < 0) and (_parent.scrollTextQuote.scroll < limit))) {
    			mode = "none";
    			_parent.scrollTextQuote.scroll = limit;
    		}
    		setSlider();
    	}
    }
    
    // set the slider position according to the scroll
    function setSlider() {
    	sbHeight = bar._height - slider._height;
    	sbAmount = (_parent.scrollTextQuote.scroll-1)/(_parent.scrollTextQuote.maxscroll-1);
    	slider._y = bar._y + sbHeight*sbAmount;
    }
    
    // get the scroll according to the slider position 
    function getSlider(y) {
    	sbHeight = bar._height - slider._height;
    	pos = (y-bar._y-slider._height/2)/sbHeight;
    	line = Math.ceil(pos*(_parent.scrollTextQuote.maxscroll-1));
    	return(line);
    }
    Link here> http://www.rustygeorge.com/Concept1_dorlas.swf
    If your friends with "P" well then your friends with me. If your down with "P" well then your down with me.

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Location
    new york
    Posts
    205
    try using the scroll bar component. It's gonna save you a lot of time.

  3. #3
    Heavyweight Pixel Champion Pixel Puncher's Avatar
    Join Date
    Oct 2002
    Location
    State of Confusion
    Posts
    485
    Originally posted by dnystwn
    try using the scroll bar component. It's gonna save you a lot of time.
    I could do that, but it seems as if you have no control over the design and look of it. Correct me if I'm wrong. Thanks
    If your friends with "P" well then your friends with me. If your down with "P" well then your down with me.

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Location
    new york
    Posts
    205
    That's what I thought before, but now that I've tried it myself, I found that you CAN change th looks.

    After adding the scroll bar component to the movie, you'll see a new folder in the library: Flash UI Components.

    Inisde that folder you'll see the ScrollBar symbol and two other folders which are : Component Skins and Core Assets

    All you need to modify the looks is inside the Component Skins folder.

    Component is basically a movie clip, so you should be able to modify it as you modify a normal movie clip

    Good luck!

  5. #5
    Heavyweight Pixel Champion Pixel Puncher's Avatar
    Join Date
    Oct 2002
    Location
    State of Confusion
    Posts
    485
    Wish it were that easy to just go in and edit it. I tried making everything 75% smaller and it looked all out of place. Besides that, have you seen how many movies within movies and all the code that is on that thing. I need more control with less actionscript that I already know so little about. There has to be a simple fix to the one I have already made. I'm already way into this project to start new, just need a fix. Anyways, thanks for the help.
    If your friends with "P" well then your friends with me. If your down with "P" well then your down with me.

  6. #6
    Heavyweight Pixel Champion Pixel Puncher's Avatar
    Join Date
    Oct 2002
    Location
    State of Confusion
    Posts
    485
    Ok well if no one on the boards has an answer, does anyone have a good example of a scroller? The ones in the Tutorial/Movie sections aren't all that great. I'm not really looking for one already made but a good source to build from scratch.
    If your friends with "P" well then your friends with me. If your down with "P" well then your down with me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center