when ever i put this AS in a button:
_root.var+=1
is adds a “1” not 1 so it looks like this:
0111111111
how do i avoid that?
I assume var is a temporary name, as you can’t use ‘var’ as a variable name, as it is reserved.
var myvar = 0;
on(press){
_root.myvar+=1;
trace(myvar);
}
myvar traces as 1,2,3,4… as I click the button. How are you outputting the text?
Clipboard Actions: Line 1: Statement must appear within on handler
var myvar = 0;
nope dont work
that is an error not a trace, the line has yet to be executed. You need to do what it says and put it in an on event handler, the “var myvar = 0;” is not within a handler, you can declare this in another place then just inrement it with the button.
You may also want to delcare a datatype when creating the variable:
var myvar:Number = 0;
it says “ouput” window with 1,2,3,4 how i put that in the variable?
plz help? plz?
ummm. it’s in the variable already if its tracing
hahaha, yes, as stated, remove the ‘trace’ line and then call ‘myvar’ to get the value.