Pwnz j00 <-- AS: Main
_____________
AS: Variables by Rantzien
gotoAndStop(); by Inglor
AS: ClipEvents by Inglor
AS: Subtitiles
Part I: Necessary AS Knowledge
This tutorial is for beginners, you don't have to be a programmer to use it.
What you need to know is:
-Basic events.
-gotoAndPlay / gotoAndStop.
-"if" conditions.
Part II: Introduction
Hello again, newgrounders. Today you will learn how to create a simple subtitles system that can contain more than 10 languages! This won't be very long, no explanations needed for such a basic code.
WARNING: This tutorial will NOT teach you other languages, if you only speak english and you don't have a translator, this tutorial will be quite useless for you.
For the code examples I will be using english and french, feel free to change it.
There are two ways to make subtitles, I will be explaining both - Choose the one you prefer.
Part III: Getting started
I suppose your movie is already done, if not, then finish it.
Follow the instructions very attentively:
- Make a new layer named "Subtitles".
- Add a keyFrame on the frame where you want the player to choose his language.
- Make as many buttons as the number of languages available.
- Give the buttons the following code:
Button one: (Without subtitles)
on(press){
_root.language = 1;
}
Button two: (Language 1)
on(press){
_root.language = 2
}
Button three: (Language 2)
on(press){
_root.language = 3;
}
etc...
- Add a new keyFrame on every frame you want the subtitles to change.
- Choose the way you prefer:
Part IV: First way of making subtitles
Create a new MovieClip on the first frame you want the subtitles to appear (Must have a keyFrame). Then, leave a blank frame on frame 1, a frame with the first subtitles on frame 2, 2nd subtitles on frame 3, etc...
After you're done with that, paste the following code on your movieClip:
onClipEvent(enterFrame){
this.gotoAndStop(_root.language);
}
Pretty simple, eh?
Now create a new movieClip, type your subtitles, and add the same code...
Part V: Second way of making subtitles
This one is a little bit more complicated. Make a dynamic textbox. Go to propeties and set its var to: sub <--- case sensitive. Make it multiline. (See picture below).
Now on every keyFrame you have, paste the following code:
(Change the sentences between the hyphens to whatever you want in the language you want)
_root.onEnterFrame = function(){
if(_root.language == 1){
sub = " ";
}
if(_root.language == 2){
sub = "here you need to type the subtitles in the first language you have";
}
if(_root.language == 3){
sub = "here you need to type the subtitles in the second language you have";
}
if(_root.language == 4){
sub = "here you need to type the subtitles in the 3rd language you have";
}
if(_root.language == 5){
sub = "here you need to type the subtitles in the 4th language you have";
}
//etc...
}
Paste that code on every keyframe you have, typing what you want it to be in every language.
Part VI: Test your movie!
Now you can test your movie, you're done!
:)
Have a nice day! :D