here is my script
Frame 1: Making the Function
[AS]stop();
function button_mc(target_mc, output_name, output_frame, outcome_number){
var outcome_num:Number = outcome_number;
target_mc.mc_txt.text = output_name
target_mc.onRollOut = out;
target_mc.onRollOver = over;
target_mc.onRelease = function(){
gotoAndStop(output_frame);
//trace(outcome_num);
}
}
function over() {
this.gotoAndPlay(‘over’);
}
function out() {
this.gotoAndPlay(‘out’)
}
button_mc(play_mc, “Play”, 2);[/AS]
Frame 2: This is where i set the variable in the function
[AS]if(name_input == null){
name_output.text = “Player”
}else{
name_output = name_input
}
button_mc(rock_mc, “Rock”, 3, 1);
button_mc(paper_mc, “Paper”, 3, 2);
button_mc(scissors_mc, “Scissors”, 3, 3);
button_mc(start_over, “Start Over”, 1);[/AS]
Frame 3: This is where i try to trace the variable
[AS]trace(outcome_num);
if(outcome_num == 1){
outcome_mc.mc_txt.text = " Wins!"
}else if(outcome_num == 2){
}else if(outcome_num == 3){
}[/AS]
when i trace the variable it just says undefined, but when i trace the variable on frame two it traces the number. how do i get it to trace the number on the third frame??
Also i was wondering i have an input text box in frame 1, and an dynamic text box on frame 2, and when i input the text it shows up in the output box, but when i try to do the if statment on frame two, make it say just “Player” when nothing is entered, it always just shows nothing, how am i supos to make it show Player?