all groups > flash actionscript > december 2005 >
You're in the

flash actionscript

group:

sliding content


Re: sliding content tralfaz
12/31/2005 11:20:52 AM
flash actionscript:

[quoted text, click to view]

The link isn't working, but anyway, store your positions in variables
instead of in the object itself. Incrementing the object's properties
directly can result in decimal place round-off etc. Many objects
won't increment certain properties in a linear way.

Instead of something like _x++
Use an storage variable like this..
xpos++;
Then assign it to _x:
_x = xpos;

Start with whole numbers and keep it on whole numbers..
Initialize to a whole number to start..
xpos = 100;
Then add only whole numbers...
xpos += 5;
tralfaz

sliding content dirkness
12/31/2005 4:02:35 PM
hi

I'm developing a site using sliding content - controlled with up and down
buttons. But I'm having problems with the positioning 'degrading' the more the
up / down buttons are pressed:

You can see this here: http://www.detkendesign.com/detken2/portfolio.htm

I'm using the AS below for the buttons.

Grateful for any ideas on a fix.

Thanx

Dirk


onClipEvent (load) {
_x = 0;
_y = 0;
div = 5;
}

onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;


_root.up.onRelease = function() {
if(_y<-260){
endX = 0;
endY = _y+260;}
};

_root.down.onRelease = function() {
if(_y>-1040){
endX = 0;
endY = _y-260;}
};

}
AddThis Social Bookmark Button