Macca Blog

My life experiences with code and design

The upgrade to spacemissionFx 1.0

Posted on by Mark

Since the release of JavaFX, there have been a few nice articles about the upgrade from the preview release of JavaFX, to the 1.0 SDK. Like this article: Migrating from the JavaFX Preview release.

I thought, instead of re-iterating what has already been said, I would just go over what I had to do to get my SpaceMissionFx app to compile and run on the 1.0 SDK.
Thankfully, there was very little to do, a lot of what I had to do was simple syntax changes, which in my opinion are for the better.

Here are the changes:

  • public attribute –> public var, the name change of attribute to var. Much less confusing, and there will be far less forum postings of people asking the difference between the two of them.
  • private attribute –> var, everything is private by default, which is nice, considering that most of the declarative variables that I use in my classes are private!
  • Timeline method change from start() –> play() a simple change, which is far better in my opinion. Makes more sense this way, considering that you are really “playing” a time line.
  • Nodes now have multiple transfor elements available to them, so the change from transform to transforms, which is an array of Transform objects.
  • closeAction –> onClose this one was a simple function name change on the Stage object used in the game.
  • The KeyEvent object that is used for handling key press events has a few changes, one of which is the getKeyText change to text, which also highlights the new “properties” based implementation which I think is very cool.

So thats about all I needed to change in order to get this working in the game.

The blue text being the new way and the red text being the old way.

The next thing to do would be to give a link to the new game implementation, its not without its bugs and junk, but its a great way to waste a few seconds if you are bored!

Click the below link for the webstart JNLP file:

As for the future of the game, it was just a fun way to get myself into the world of JavaFX so I might be focusing on other samples and finding of the JavaFX world from now on, rather than getting the game to a perfect state.

Cheers, till next time.

This entry was posted in JavaFX, SpaceMissionFX, Web Start. Bookmark the permalink.

Leave a Comment

Your email address will not be published. Required fields are marked *