PDA

View Full Version : Sliding on the y Axis?



dr_red
December 8th, 2003, 12:09 PM
Hey All,
Happy Holidays! :?)

I finished Kirupa's tutorial on the "Sliding Menu" and have a question for all you actionscript gurus...

The tutorial shows how to make the movie clip slide on the horizontal (x) but how do I configure the code to use both horizontal and vertical (y)?

I know this is asking for alot but I really am a novice at this actionscript stuff :bu:

Do I just add a dest=" _root.ynew ;" and "pos = this.y ;" some how to this code?

stop () ;
MovieClip.prototype.move2 = function () {
dest = _root.xnew ;
pos = this._x ;
vel = vel*0.7 + (dest-pos)/6 ;
this._x += vel ;
}
MovieClip.prototype.move = function () {
dest = _root.xnew ;
pos = this._x ;
vel = (dest-pos)/6 ;
this._x += vel ;
}


Here is a link to the tut:
http://www.kirupa.com/developer/flash5/slidingmenu.htm

I'm just trying to learn,

Thanks for your help!
-The Dr.

radicaljugnu
December 8th, 2003, 12:15 PM
change _x to _y

dr_red
December 8th, 2003, 12:22 PM
So does this look right if I want them both to work?

stop () ;
MovieClip.prototype.move2 = function () {
dest = _root.xnew ;
dest2 = _root.ynew ;
pos = this._x ;
pos2 = this._y ;
vel = vel*0.7 + (dest+dest2-pos+pos2)/6 ;
this._x += vel ;
}
MovieClip.prototype.move = function () {
dest = _root.xnew ;
<b>dest2 = _root.ynew ;</b>
pos = this._x ;
<b>pos2 = this._y ;</b>
vel = (dest+dest2-pos+pos2)/6 ;
this._x += vel ;
}