[Flash Professional 8]3d rotation of a cube in 2d

I’am a beginner with flash and I’am searching for a actionscript for a cube. You can only see 1 side at the time so in 2d and than there are 4 buttons within a movie clip at each side of the square. By using those buttons the cube should rotate like when having a dice in your hand. The problem now is that when I turn up and then right or left the wrong number is appearing.
So actually a script in which you can navigate between the different sides of a dice. I hope someone will respons.