Sign in to follow this  
kingsrookie

flash 8 actionscript help

Recommended Posts

I am pretty new to flash but not new to programming itself. I have a book that is teaching me what i need to know but cannot get past a certain part at all. I am making a simple math program that when you are on a simple page, the input text box will be your answe45r to the problem. I have programmed the button that takes you to the next frame to determine if you are correct. Now, all of my instances are labeled and my variables are labeled. I have 2 dynamic text boxes that calls forth two random number which you need to solve. My input text variable is (answer) now when i goto the next frame to see if i am correct or not, I am using a simple if else statement. the formula i have for the correct answer is the variable (correct). i have a dynamic box with the variable (result) to tell if i am correct or not my if statement is if (_root.answer == _root.correct){ result = "Good job!"; } else { result = "Wrong!"; } that is the simple command. My if else statements work if all the variables are on the same page but when i recall the variables with _root on a new frame, it doesn't want to work. I have used trace command to see if the (answer variable) is being carried over and it does. it also equals (correct) yet it always skips the first part of the if statement. Always assuming that it is wrong. I started the program on my own and then consulted the book for help. When it didn't work I programmed solely from the book and it still doesn't work. Yes, my actionscript version is the same as the book's but I can't get if else to work if recalling variables from another frame. [Edited by - kingsrookie on January 17, 2009 7:06:01 PM]

Share this post


Link to post
Share on other sites
Assuming I understand you correctly and everything you say is true, I believe what you want is this:

if (_root.answer == _root.correct){
result.text = "Good job!";
} else {
result.text = "Wrong!";
}


In actionscript it's possible to set an instance to an arbitrary value -- in this case a string -- but it's probably not what you want. Rather you appear to want to set the text property of a dynamic text area.

That's just a guess though. If that doesn't solve your problem you might try asking on a dedicated flash forum, there are plenty out there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this