Step1
Open your .Fla file from http://www.ehow.com/how_2183368_control-movie-clip-flash.html.
Step2
make an area you would like
to be the spot that gives
damage.
Step3
then make it a movie clip.
and call it what ever you'd
like. I've called min "collision area"
Step4
now go into the action script of your
new made movie clip.
Step5
now type in:
onClipEvent (load) {
damage = random(9)+1;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player_mc)) {
_root.playerHp -= damage;
}
if (_root.playerHp<1) {
_root.playerHp = 0;
}
}
explanation;
playerHp is going to be the dynamic text box with the health.
player_mc is the name of our player in this case object.
we will be making a variable called damage because it is easier to change.
Step6
now we will make a dynamic text box
and give it the variable name "playerHp".
as you can see on the pic. there is
to types of boxes in the text box
properties window. the one called "instance name"
refers to the graphic part of the text box,
but the one called "var" refers to the text
inside of it.
Step7
now go to the main timeline' s
first frame and add:
playerHp = 100;
Step8
if you want to you can try to make a movie clip with a square with the scales x=200 and y=15, now ad to the script of this movie clip: onClipEvent (enterFrame){
this._xscale = _root.playerHp;
}
make sure it is placed like on the picture in compared to the
little "+".