Tuesday, May 22nd 2012, 1:35am UTC+2

You are not logged in.

  • Login
  • Register

JasonS

Beginner

Posts: 40

Location: Pittsburgh, PA, USA

Occupation: IT

1

Tuesday, November 15th 2011, 8:14am

Present Snatch

Got bored, made a goofy little Christmas game. It's called "Present Snatch"...

It's on the main page of www.tecktronic.net

Or the page can be directly accessed via http://www.tecktronic.net/xmasgame/

Happy Holidays!
~Jason

theuserbl

Intermediate

2

Thursday, November 17th 2011, 12:39am

Nice.

But after closing the browser window with this game, there comes every time a NullPointerException.

Can you please trying, if it helps to add the following SUB to your Applet1 class?

Jabaco Source

1
2
3
4
5
6
Public Sub destroy()
  Timer1.Enabled = False
  Timer2.Enabled = False
  Timer3.Enabled = False
  Timer4.Enabled = False
End Sub



There existing four SUBs which are automatically called in Java Applets:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
Public Sub init()  ' Is called one time after the Applet starts
End Sub

Public Sub start()  ' Is called every time when the users goes back to to Applet window
End Sub

Public Sub stop()  ' Is every time called, when the user goes out from the applet
End Sub

Public Sub destroy()  ' Is every time called, when the user closed the browser window with the Applet
End Sub


Greatings
theuserbl

JasonS

Beginner

Posts: 40

Location: Pittsburgh, PA, USA

Occupation: IT

3

Thursday, November 17th 2011, 2:41am

Hi theuserbl,

I changed what sub the timers are shut off in to Sub destroy()... and guess what? It worked. **Thank you** I have been trying to figure out how to do this for, quite some time with little success. How did you figure this out? =P

To all of those as confused as me... Please note that.. Sub Applet_Destroy() and Sub Destroy() are not the same thing, obviously lol.

This was the main reason I would get exceptions in all of my other web applets too when closing them. I knew there had to be a way. And you got it! Once again, a sincere thank you for this info. :)

Sincerely,
Jason

JasonS

Beginner

Posts: 40

Location: Pittsburgh, PA, USA

Occupation: IT

4

Wednesday, December 7th 2011, 9:01am

About destroy() and Me.destroy

A few things to add to this subject.. since I could not find any similar threads about the subject...


To get your winsock/graphical app to close correctly.. You must use the Sub destroy() ... not Applet1_Destroy() ... Inside of that sub, you must kill all timers, animation loops, and winsock connections [using Winsock1.Close() or whatever your winsock is named...], then I have also found it helpful to add in a line at the very end of Sub Destroy()... Me.Destroy()

Now, make sure when you type in the () at the end of the line with Me.Destroy() on it, that you have Me.Destroy () <1> selected, NOT Me.Destroy() <2> .. took me awhile to figure out that version 2 of this method does not work.. even though they look identical in the intellisense.. Its weird, but it works..

Greetings,
Jason

This post has been edited 1 times, last edit by "JasonS" (Dec 8th 2011, 3:12am)


JasonS

Beginner

Posts: 40

Location: Pittsburgh, PA, USA

Occupation: IT

5

Friday, May 11th 2012, 4:32am

Source code

Hi,

I have made the source code to this applet available at http://www.tecktronic.net/xmasgame_sourcecode.zip

This is a basic example of how to use the .PaintPicture method and an animation loop, without the need of using any sockets or connection to a remote server.

Please compile your applet as a .jar file and place in same web server directory as index.html and xmasgame_with_facebook_posting.html . The facebook html file shows how to make 'prompts' to post things to a users wall popup, using string data from the applet itself (score, etc). This feature uses javascript, there are ways to do it with php too.

Enjoy, and please let me see anything cool that gets derived from this. :)

Regards,
Jason

Rate this thread
WoltLab Burning Board