Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Flash image scroller - making it auto scroll

    I have a small flash image scroller that scrolls a row of buttons horizontally based on the users mouse movement. (half finished version shown at bottom of page at www.bizmagic.com.au/preview/bkind)

    Its basically a movie clip contained a row of buttons, with AS applies as follows:

    Code:
    onClipEvent (load) {
    	// size of one of the Movie Clips
    	MCsize = 1430.0;
    	// size of stage
    	StageSize = 550;
    	// increase decrease speed.
    	speed = 5;
    	
    	
    	function moveLeft(nPixels) {
    		this._x -= nPixels;
    		if (this._x<0-MCsize) {
    			this._x = 0;
    		}
    	}
    	function moveRight(nPixels) {
    		this._x += nPixels;
    		if (this._x>0) {
    			this._x = 0-MCsize;
    		}
    	}
    }
    onClipEvent (enterFrame) {
    	if (_root._xmouse<StageSize/2 && _root._xmouse>0) {
    		moveRight(speed-_root._xmouse*speed/(StageSize/2));
    	} else {
    		if (_root._xmouse>StageSize/2 && _root._xmouse<StageSize) {
    			moveLeft(_root._xmouse*speed/(StageSize/2)-speed);
    		}
    	}
    }
    I was just wondering if it was possible to get the slider moving on page load instead of having to wait for user mouse interaction to get it moving!

    Appreciate any input, thanks.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Use an onLoad handler for the movie to trigger the first reaction. Is this all of the code?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

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