View Full Version : scrolling background
fzappa90
03-28-2005, 04:34 PM
what action scripting do i need to add to buttons that allow my background to scroll left and right and loop around. here's an example i found
http://www.worldofwassco.com/arcade/index.htm
any help will be greatly appreciated.
p
Hi,
You can create a scroller with something like this....
speed = 5;
_root.mcName.onEnterFrame = function() {
//create mouse scroll postions
if (_root._xmouse>Stage.width/2) {
_root.speed = 5;
} else if (_root._xmouse<Stage.width/2) {
_root.speed = -5;
}
//create scroll
this._x += speed;
if (this._x>Stage.width) {
this._x = 0;
} else if (this._x<0) {
this._x = Stage.width;
}
}
You could add another if statement to control the scroll from a button....
myScroll=false;
if(myScroll){
_root.mcName.onEnterFrame = function() {
if (_root._xmouse>Stage.width/2) {
_root.speed = 5;
} else if (_root._xmouse<Stage.width/2) {
_root.speed = -5;
}
this._x += _root.speed;
if (this._x>Stage.width) {
this._x = 0;
} else if (this._x<0) {
this._x = Stage.width;
}
}
}
myButton.onRelease=function(){
myScroll=true;
}
hope it helps
NTD
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.