开发者

as3 | Creating an iPad-iPhone-like slide panel

Let's say I have a 2000 pixel width MovieClip (videosPane) & I want it to slide nice and smooth.

without getting inside all the function (onMouseDown,onMouseUp) - the basic code is:

function onLoop(event)
{
    if (isMouseDown)
    {
        videosPane.x = (mouseX - offset);
    }
}

Now, it works fine - but I want the nice effect that when you try to slide it to 开发者_开发技巧the edges (x<0 || x>2000) it slows down by half (so you get the sense that there is no where to slide it)

I thought of making a rule like

if ((videosPane.x <0) || (videosPane.x > 2000))
{
   videosPane.x = (mouseX - offset)/2;
}

but that works sometimes (x < 0) and sometimes makes a complete mess.

any ideas how to solve the edges issue?


don't divide by two. just increase your offset or add an additional offset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜