Animated Images

BlitzMax Forums/BlitzMax Programming/Animated Images

Sean Doherty(Posted 2006) [#1]
Is there a way to determine from the data structure the number of frames in a TImage that is Loaded with an animated image?


GfK(Posted 2006) [#2]
myTImage.Frames ?


Sean Doherty(Posted 2006) [#3]
I think that is an array of the frames?


GfK(Posted 2006) [#4]
Dunno.... struggling to find documentation about it...


Yan(Posted 2006) [#5]
myImage.frames.length should do the trick.


sswift(Posted 2006) [#6]
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. :-)


sswift(Posted 2006) [#7]
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?


Byteemoz(Posted 2006) [#8]
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