Hello.. I am building a website and I would like the background to scroll along when the mouse cursor touches the edges of the screen. Basically like this: http://www.pspartgallery.com/ Any suggestions would be more than welcome! Thanks, Ginger
Hi Ginger, it is not hard to do, at least with some experinence that is. You pack your background (or whatever it is that should scroll) into a movieclip. The you check onMouseMove if the cursor is near one edge of the stage, and move the clip accordingly. Do you understand what I'm saying? If not go on asking. M
This makes sense, but how do you specify that the onMouseMove should work when it is near the edges of the stage?
laets say your satage is 500px high, and the area where you want the movie to move is 20 px from the upper and lower end of the stage it would be: (beware of typos it's just for the general idea of it) _root.onMouseMove() = function(){ if (_root._ymouse < 20){ bgr_mc.onEnterFrame = function(){ this._y -= 5; // 10 if you want it to scroll faster, 2 for slower... } } else if (_root._ymouse > 480){ bgr_mc.onEnterFrame = function(){ this._y += 10; } } else { delete bgr-MC.onEnterFrame; } updateAfterEvent(); } You would have to make sure to stop before your movie runs offscreen and also deletinf the onEnterFrame function only when necessary would be a good idea, but as a startingpoint that should do. M
Don't see what you're looking for? Try a search.
|