-
Really simple IF now working :(
Right,
I have coded a button so that when it get's pressed it defines a variable and then an if function to tell me if it works?
PHP Code:
my_button.onPress = function() {
_root.clicked = true;
}
if (clicked == true;) {
trace("clicked is true");
}
But as soon as the movie is exported it gives me the trace without the button being pressed?
-
Take the semicolon out of the if statement.
Code:
if (clicked == true) {
Last edited by Upchurch; 03-04-2008 at 12:39 PM.
-
Yeah it was just a typo, I don't have the source .fla so i just typed it in...
-
okay, is clicked declared anywhere outside of the code you gave here and, if so, is it ever modified somehow that it might be shown as true?
-
My guess is that the button hit-check is not inside _any_ function that's been checked... try the code below with and without the "this.onEnterFrame = function () {" and of course the trailing "}" to see the "problem"
Code:
var clicked:Boolean = false;
this.onEnterFrame = function() {
my_button.onPress = function() {
clicked = true;
trace("clicked:" +clicked+ " YEAH");
}
if (!clicked) {
trace("clicked:" +clicked+ " YEAH");
}
}
Why do it the Hard way, when you could do it the Impossible way
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|