Make your character talk when he/she/it gets clicked
For this example we will also only be using layer 1. Using the oval tool draw out a circle of any colour and convert it to a movie clip. NOTE: I am only using a circle as an example, this would be your character. Now double click on your character. Start by right clicking on frame 1, and selecting actions. On the first line type in: stop();
Now insert a keyframe at frame 2. On frame 2 we need to put in the words that we want our character to say. Using the text tool (static text), insert a text box just above his head, for this example I want him to say: learningflashpro.blogspot.com.
I want the player to have enough time to read this, so I inserted a keyframe at frame 40. (this may be different for you, if you only have a short sentence like mine, use about 40 frame, otherwise just muck around with it until it is right).
On the last keyframe, in my case this would be frame 40, right click and select actions, now on the first line type in:
gotoAndStop(1);
This is so when this frame is reached it will go back to frame 1 where there is no text.
Back in the main timeline, make a cursor(do this by following the steps in tut.16).
Now we need to add some action to the character, right click on your character and select actions, on the first line type in:
onClipEvent(mouseDown) {
if(this.hitTest(_root.cursor)) {
this.gotoAndPlay(2);
}
}
This means that when the mouse has been pressed down the character movie clip will play.
That is it, pretty easy wasn’t it?
NOTE: to advance on this tutorial try instead of just using text, change it to audio.
Remember that you will need to insert a new layer to do this.
By now you should have the knowledge to do this, if not, I recommend that you go over some of the previous tutorials.
For further reference: the ads on this site contain great things about flash, consider trying them out.
No comments:
Post a Comment