LoadAnimImage

BlitzMax Forums/BlitzMax Beginners Area/LoadAnimImage

Hi after using LoadAnimImage, I've asserted that the image loads which it does, but when I look in image - frames in the debugger, all the frames are Null.....anyone any ideas how this would happen if the image is loading?
thanks

You have to use (e.g. drawimage) the frame to create the TImageframe object. It is the pointer to this object that you see in the debug window.

hmm.any time I try and change the frame, it says 'attempt to index array element beyond array length'.....yet it seems to loads the image and frames alright - aside from asserting the image (which I am doing) is there any way to check how many frames its actually loaded?
Thanks

dont you specify the amount of frames with loadanimimage?

Have you got any code to share?
Anyway...
image:TImage=loadanimimage(etc etc)
print len(image.frames)+1


I did specify how many frames...unfortunately the code is scattered and large so I cant share...thanks Tonyg I'll see what the len code spits out.

Ok...just to check something obvious...in the cell_count field if I specify 9 frames, then as its an array they are stored 0...8?

thanks

Yes, unless the first frame parameter has something other than 0 in it.
Image:TImage = LoadAnimImage("Image.png",32,32,0,9)

will have frames 0..8
Image:TImage = LoadAnimImage("Image.png",32,32,1,9)

will have frames 0..7

Don't forget that will only reflect what you put in. It's when you try to use a frame there'll be a problem.
You could check the imagewidth/imagelength divided by len(image.frames) to make sure it returns you frame size.

Ok guys sorted. There was a bug elsewhere in my code which loaded an image without animation frames, when I was convinced it was loading an image with frames. Dahh! Thanks for all the help.