1: Get something to hit...
Before you can make the whack-a-pig game, you need to get something to whack. Your character need not be as elaborate as mine, but you need to show some reaction, so I suggest you have at least a smiley face and a sad face.
You don't need any button actions yet - the button action in my example below is simply so you can see how this will work. Make a happy graphic and a sad graphic and then combine the two to make a 'whack' animation like mine. To do this, open a new movie clip symbol- call it 'whack'. In the 'whack' symbol: frame one place your happy graphic, in frame 2 place your sad graphic, then use F6 to make keyframes at frame 4 and frame 6. Add motion tweening to frame 2 and frame 4. Select the symbol on frame 4 and scale it vertically a little so that the top of the head moves down as if whacked.
make a flash effect when the character is whacked, you
simply add a spikey shape in a layer below the head at
frame 2, then at frame 3, add an empty keyframe (F7) to
make sure the flash only appears for one frame. Go back
to your main scene - open the library (Ctrl-L) and drag
the MC onto the stage.
Test the movie - your pig should be constantly bobbing up and down as if being constantly hit. After checking the animation, add one more layer to the MC, call the layer "actions" and select frame one. Open the ActionScript window (Ctrl-Alt-A) and add a 'Stop()' action. Later on, we will tell this MC to play whenever the pig is whacked.