PDA

View Full Version : Conditional loop problem


Bones
10-14-2007, 10:26 PM
Well, my Actionscripting isn't getting any better :confused:

I'm trying to make a conditional loop: a number is incremented everytime a loop occurs, and compared to a number loaded from an .txt file. So..

Frame 1:
var thisCount:Number = 0;
// This is the loop counter

var AllEntries:Number = TOTALNUMBER;
// TOTALNUMBER is the number loaded from the .txt file

Frame 2:

AllEntries++
// To increment AllEntries by one

Frame 3:

if (thisCount==AllEntries) {
gotoAndPlay(1);
}
// So if the number of loops is equal to the number from the file, it goes back to the start, and the number of loops is reset to 0

The trace command shows that the numbers are loading / incrementing properly, but the "if" command on Frame 3 doesn't seem to do anything. The loop number just carries on going :(

As usual, all help very gratefully recieved. Many thanks

atomic
10-14-2007, 10:56 PM
What do you get on a trace action?

if (thisCount==AllEntries) {
trace("thisCount: "+thisCount+" - AllEntries:"+AllEntries);
gotoAndPlay(1);
}

Bones
10-15-2007, 10:36 AM
The traces all appeared to be fine.

However, I've now solved the problem. The number in the txt file had a hidden carriage return after it, so instead of being a number (ie 3) it was something like this: 3¶

Thanks for your help, atomic.

atomic
10-15-2007, 12:39 PM
;)