Wow, I thought I knew Flash until I decided to learn ActionScript. Now even the most basic things are taking me forever to learn. So I apologize for my newbieness, I’m really smart, I promise!
Anyways, here’s my easy question of the day. I have a variable i that I’m setting to 5. i = 5. Simple enough, I have a dynamic box on the screen so I know that’s working.
On the same screen, I have a button, that when you click it, it should do the function i = i + 1. I know this isn’t working because when I click it, the number on the screen doesn’t change.
Also I have a second button that is a collection of if/else if statements. Basically, if i=1, goto 10, else if i<1, goto 40, else if i>1, goto 40. I know that since I’m setting the initial value of i to 5, it’s impossible for i to be equal to 1. Yet every time I click this button, I goto 10 even though i doesn’t equal to 1.
Can anyone help out on these two problems? Am I not using the variable i correctly here?
After mucking with my code on the button that increments the i variable, I figured out that the button is indeed working, just the screen wasn’t refreshing. Anyways, now that I know that’s working, I know my problem is something with the if then statement I’m working with.
Here’s the exact code I’m working with that’s not working for me:
on (release) {
        if (i = 1) {
                gotoAndPlay (10);
        } else if (i > 1) {
                gotoAndPlay (40);
        } else if (i < 1) {
                gotoAndPlay (40);
        }
}
Please help, it seems basic enough yet for some reason, even though i isn’t each to 1, I’m always going to frame 10!!!
Ah ha, so it’s supposed to be i == 1 and not i = 1 in the if then statement. Don’t you feel smart when you solve problems on your own? Too bad that took up 3 hours of my afternoon. Thanks anyways for the help, I’m sure I’ll be back later for more help.
welcome to the boards. Sorry I didn’t catch this post sooner. I was busy with my projects. Again, welcome.