Jump to content


loop problems


  • You cannot reply to this topic
3 replies to this topic

#1 FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 10 January 2006 - 05:08 PM

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

#2 ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

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

Edited by ronson, 10 January 2006 - 05:32 PM.


#3 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

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:
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? :ph34r:
so again the right code would be:
a = 0;
i = 50;
while(i<100){
	a++;
	i++;
	trace("this loop is working");
}

Everything cool now? :D

Have fun :mellow:
Funkysoul

#4 FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

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.

^_^ ^_^ ^_^ ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users