im using a tutorial that says the following code plays at least once
a = 0
for(i=min; i<100; i++){
a++;
trace("this loop is working")
}
it doesn't even trace once so i'm assuming it didn't play at all
also this code doesn't play once either:
a = 0
i = min
while(i<100){
a++;
i++;
trace("this loop is working")
}
same problem here no trace
loop problems
Started by FlashGameboy, Jan 10 2006 05:08 PM
3 replies to this topic
#1
Posted 10 January 2006 - 05:08 PM
#2
Posted 10 January 2006 - 05:18 PM
Well i'm not actionscripter, i hate the stuff but i'm thinking that your problem with the first line...
Just looked up the FOR loop in actionscript and the only error i can actually see with your code is you don't have a space between
the ){ at the end of the first line.
Another thing is, have you declared "min" that you use in the loop? I think for even actionscript you must declare it.
For example
Dim i as integer
For i = 1 to 10
<code here>
Next I
Is it bring up any errors?
Hope it helps.
James
Just looked up the FOR loop in actionscript and the only error i can actually see with your code is you don't have a space between
the ){ at the end of the first line.
Another thing is, have you declared "min" that you use in the loop? I think for even actionscript you must declare it.
For example
Dim i as integer
For i = 1 to 10
<code here>
Next I
Is it bring up any errors?
Hope it helps.
James
Edited by ronson, 10 January 2006 - 05:32 PM.
#3
Posted 10 January 2006 - 06:52 PM
ok first of all.. why you telling i=min? you didn't define min yet...
anyways, FOR loops are being written like this:
your second actionscript has the same problem.. you didn't defined "min" anywhere.. from where should flash know what min means?
so again the right code would be:
Everything cool now?
Have fun
Funkysoul
anyways, FOR loops are being written like this:
a = 0;
for(i=0; i<100; i++){
a++;
trace("this loop is working"+i); //added the variable I to check the nice numbers :p
}
your second actionscript has the same problem.. you didn't defined "min" anywhere.. from where should flash know what min means?
so again the right code would be:
a = 0;
i = 50;
while(i<100){
a++;
i++;
trace("this loop is working");
}
Everything cool now?
Have fun
Funkysoul
#4
Posted 11 January 2006 - 06:57 PM
Yeah, I think the problem is that the book im using isn't very accurate it says
that it would work and play just once. Thanks for solving my problem.
that it would work and play just once. Thanks for solving my problem.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
