Platformer Question: knockBack/invulnerability

I gotta say that platform tutorial is quite awesome! I used the majority of with great success. But that being said I do have question, a million questions really, but I’ll stick with this one.

After making contact with an enemy or obstacle, instead of instantly displacing the character, I was wondering how I might actually have a the enemy knockback the character a set amount. Also to have the character become invunerable for a period of time afterward.

I can post the FLA if it’s needed.

My theory is, and I’ve tried with no success, to have the enemy have something like

if (this.hitTest(_root.hero.hitBody) && !dead){
_root.hero.damage = true;
}

Much like the death thing, then on the hero have something like:

if(damage){
speed+=knockBack;
gotoAndPlay(“damageFrame”);
}

something close to that anyway.

Any help would be greatly appreciated.