Eachin loop problem
BlitzMax Forums/BlitzMax Programming/Eachin loop problem
| ||
Having the following code snipet: Print "Entering" imgPart=New TPixmap[4] For Local i:TPixmap=EachIn imgPart imgPart[index] = PixmapWindow(origImage,(x*partWidth-partWidth ) ,(y*partHeight-partHeight ),partWidth,partHeight) 'Print index+" - "+x+" - "+y+ " - "+(x*partWidth-partWidth )+" - "+(y*partHeight-partHeight )+" -- "+(index Mod 2) If (x Mod (Int(Sqr(pieces)))) =0 y=y+1 x=1 Else x=x+1 EndIf Print index index=index+1 Next Print "Leaving" the for loop is never entered. something that was working in MAX 1.12 Is there any difference in the new 1.14 with null objects? Thank you |
| ||
You can't use an Eachin on an array of nulls. Although you define your array as containing 4 pixmaps, you've only created the array, not the data to fill it, and Eachin won't work. Instead use For Local index:int = 0 to 3 Once your array is populated, you could use the EachIn. |
| ||
Thanks alot Brucey :) |