PDA

View Full Version : Load .swf && sliding menu



The_Vulcan
September 26th, 2003, 09:51 AM
Below is the code from a siding menu that works fine..............


onClipEvent (load) {
xcenter = _root.box._x + ( _root.box._width/2);
speed = .03;

lowX = _root.box._x;;
highX = lowX - (this._width - _root.box._width);}
//**************************************************
onClipEvent (enterFrame) {

if (_root.box.hitTest(_root._xmouse, _root._ymouse, false)) {

var distance = _root._xmouse - xcenter;
_x -= ( distance*speed );


if (this._x >= lowX) {
this._x = lowX;}
else if (this._x<=highX) {
this._x = highX;}
}
}
//**************************************************

However after loading this into another movie it wouldn't move, I made some changes and now it scrolls only to the left. Can someone please tell me what I have over looked ?????



//**************************************************
onClipEvent (load) {
xcenter = _level0.tops_contain.box._x + ( _level0.tops_contain.box._width/2);
speed = .03;

lowX = _level0.tops_contain.box._x;;
highX = lowX - (this._width - _level0.tops_contain.box._width);}
//**************************************************
onClipEvent (enterFrame) {

if (_level0.tops_contain.box.hitTest(_root._xmouse, _root._ymouse, false)) {

var distance = _root._xmouse - xcenter;
_x -= ( distance*speed );


if (this._x >= lowX) {
this._x = lowX;}
else if (this._x<=highX) {
this._x = highX;}
}
}
//**************************************************

pom
September 27th, 2003, 10:37 PM
Use relative addressing: http://www.kirupa.com/developer/actionscript/tricks/relativeaddressing.htm