Animated Images

BlitzMax Forums/BlitzMax Programming/Animated Images

Is there a way to determine from the data structure the number of frames in a TImage that is Loaded with an animated image?

myTImage.Frames ?

I think that is an array of the frames?

Dunno.... struggling to find documentation about it...

myImage.frames.length should do the trick.

This is what I use:

Function ImageFrames%(Image:TImage)
Return Image.Frames.Dimensions()[0]
End Function

I don't know about that length suggestion. I don't see why it would be stored in two locations, or how I could have missed that. :-)

Ah I see. Dimensions was a special array command, and Length is as well. Length returns the total number of elements, and Dimensions I guess is for multi dimensional arrays which have elements of different lengths maybe?

Dimensions returns the length (size) of each array-dimension:
Local a:Int[2,3,4,5]
Print "Total items: " + a.Length
Print "Number of dimensions: " + a.Dimensions().Length
For Local n:Int = 0 Until a.Dimensions().Length
	Print "Dimension " + n + " Length: " + a.Dimensions()[n]
Next

--Byteemoz