Sprite error - InvalidOperationException

abeery

Member
Licensed User
I'm stumped... when I run this code from the IDE everything works but when I run it from my phone I get an error dialog with the message:

Basic4ppc

Error loading program.
InvalidOperationException

All I'm trying to do is write some text to a bitmap and then replace an existing sprite with the new sprite containing the updated image... code below. I've tried marking for delete, disposing and everything else I can think of but no luck... always works in IDE but fails on device... interesting thing is if I put a DoEvents I can cause the error dialog to temporily be hidden and the program continues to run but the moment the dialog appears and I close it the app terminates

I would appreciate any help

Code:

Sub updateScreenMessages(passedKey)
ErrorLabel (updateScreenMessages_error)
If transparenttextsprite.IsActive=True Then
transparenttextsprite.IsActive=False
Else
Drawer.DrawImage1(eraser.Value,rect.Value,rect.Value,False)
myString = passedKey '& " " & TimeS
Drawer.DrawString1(myString,20,brush1.Value, 0,0)
transparenttextsprite.Dispose
AddObject("transparenttextsprite", "Sprite")
transparenttextsprite.New3(Bitmaptext.Value,1,480,200,1)
transparenttextsprite.X= 0
transparenttextsprite.Y= 375
transparenttextsprite.CurrentFrame = 0
gw.SpriteAdd(transparenttextsprite.Value)
DoEvents 'this guy allows the error to be hidden briefly
End If
Return
updateScreenMessages_error:
End Sub
 

abeery

Member
Licensed User
InvalidOperationException

I've uploaded a screen shot but the source zips to a file too big to upload... if you PM me an email address I'll send you directly... thanks for your help!
 

abeery

Member
Licensed User
Thanks for agreeing to look at this... I have managed to work around the error by replacing the sprite with an imagebutton so I won't waste your time.
 
Top