Auctane
09-04-2007, 02:15 AM
Hi there, I'm new here. I've just started learning ActionScript 3.0. I have some programming experience. I have a bunch of programs I want to write and I bought some books, Essential ActionScript 3 being the one I'm part way through now. The thing is, none of the books i bought really touch on basic programs. So I took it upon myself to start experimenting with code. I've done a couple small programs now, but this one stopped me and I've been searching all over the internet for tutorials or example code and cannot find any.
Heres what I want to do:
Wise Guy -
1) I have a DynamicText box that greets the user and asks their name
2) There is a TextInput field for them to enter their name.
3) Generate a random boolean for a var 'wiseGuy'
4) In the DynamicText box, the text changes to "Hello (name entered by user), you are (or are not) a wise guy."
right now my code looks like this and doesn't work:
var hi;
var player;
var wiseGuy;
wiseGuy = Math.random();
player = playerName_txt;
if (wiseGuy >= .5){
hi = (player + ", you are a WISE GUY!!");
}else{
hi = (player + ", you are not a wise guy.");
}
hello_txt = hi;
~edit: I changed the code and cut back to ActionScript 2 so I could tie a var to the text field. Now my only problem is to get the input text to wait for text and then continue into the coin flop...
Pointing me at some code or a tutorial or help would be seriously appreciated.
Heres what I want to do:
Wise Guy -
1) I have a DynamicText box that greets the user and asks their name
2) There is a TextInput field for them to enter their name.
3) Generate a random boolean for a var 'wiseGuy'
4) In the DynamicText box, the text changes to "Hello (name entered by user), you are (or are not) a wise guy."
right now my code looks like this and doesn't work:
var hi;
var player;
var wiseGuy;
wiseGuy = Math.random();
player = playerName_txt;
if (wiseGuy >= .5){
hi = (player + ", you are a WISE GUY!!");
}else{
hi = (player + ", you are not a wise guy.");
}
hello_txt = hi;
~edit: I changed the code and cut back to ActionScript 2 so I could tie a var to the text field. Now my only problem is to get the input text to wait for text and then continue into the coin flop...
Pointing me at some code or a tutorial or help would be seriously appreciated.