LoadAnimImage won't load- please help!!

BlitzMax Forums/BlitzMax Beginners Area/LoadAnimImage won't load- please help!!

Miss Blitz(Posted 2006) [#1]
God bless you for taking the time to look into my trouble!
here's a sample of the code I was working on:
Incbin "blue_pearl_blink.png"

Graphics 800,600,24
SetMaskColor 0,255,0
Global bead:TImage
bead = LoadAnimImage("incbin::blue_pearl_blink.png",176,43,0,3,MASKEDIMAGE)
SeedRnd(MilliSecs())
Local timer = MilliSecs(),Longenough = Rnd(500,4000),fmax=3,frame=0,pauselength = 900
While Not KeyHit(KEY_ESCAPE)
If LongEnough <> -1 And MilliSecs() >=timer+Longenough Longenough = -1;timer = MilliSecs()
If LongEnough = -1
If MilliSecs() >= timer+pauselength
frame:+1;If frame=fmax frame=0;timer=MilliSecs();Longenough=Rnd(500,4000)
EndIf
EndIf
Cls
DrawImage bead,MouseX(),MouseY(),frame
Flip
Wend
End

The picture runs fine put through "LoadImage", but In LoadAnimImage, I get an "attempt to access null object" error. I look at the debug info and sure enough, this image keeps on failing to load:


What do I do? If I'm leaving out any important details, do please let me know!
~MissLee


(tu) ENAY(Posted 2006) [#2]
You've got 0,3,MASKEDIMAGE but your animimage is 4 frames right?

Try 0,4,MASKEDIMAGE instead.


Miss Blitz(Posted 2006) [#3]
Ah, You're right... Oh, and look at this:
...blink.png",176,43....
I had set the "cel width" parameter to the image's width!
with some quick adjustments it works fine! Whew!
Well, it's nice to know I hadn't discovered some rare graphics card glitch that would take ages to code around.

Thank you very much for your input,ENAY! Oh, and I love your website!


(tu) ENAY(Posted 2006) [#4]
Easy mistake to make, I do it all the time since in old Blitz you declare your arrays as one less than the actual size.

dim myarray(3)

global myarray:TImage[4]


Catches me out all the time.