Actionscript for acceleration, constant movement, and deceleration

I’m trying to make a box move from left to right with the press of a button. However, the details of this movement is such:

  1. Upon pressing a button, the box accelerates (easing motion) from 0 to 5 pixels per frame.
  2. Once the easing hits 5 pixels per frame, I want the box to hold that motion until the button is released.
  3. Once the button is released, I want the box to decelerate from 5 pixels to 0 pixels.

I am familiar with the p(t) = t * v equations, but I am unsure how to implement it in this particular fashion. If anyone has any tips or clues, I’d greatly appreciate it! Thanks.

====

box._x = 0;

go.onPress = function() {
// 1. make box accelerate from 0 to 5 pixels per frame to the right
// 2. once the box is up to speed at 5 pixels per frame, hold the rate of movement at 5 pixels per frame.
}

go.onRelease = function() {
// 1. decelerate motion from 5 to 0 pixels per frame, until the box stops moving
}