"I have never let my schooling interfere with my education." - Mark Twain

AS3 Calls to JavaScript

Author: Tommy Leung | 08.26.2008 | Category: Internet, Programming

I don’t write nearly as much programming help posts than I could be. There seems to be so much of them out there as it is. However, when I come across something that I think isn’t all that well known or clearly discussed, I feel compelled to release that information into the great unknown of the Internet.

So, I was doing a project that needed a Flash movie–coded in AS3–to make some calls to JavaScript for functionality that JavaScript is more capable of doing. There are various FSCommands that you can use in ActionScript but, nothing really suited my needs. I had some JavaScript functions that needed to be called when certain things happened in the Flash movie.

The quickest method I found for doing this is simply using navigateToURL(). You simply make a call to javascript:FUNC()wth target of _self. More specifically:

navigateToURL("javascript:FUNC()", "_self")

That’s it. :)

Share/Bookmark

Tips for Developing Facebook Games

Author: Tommy Leung | 08.08.2008 | Category: Internet, Programming, Video Games

The Facebook Platform has created a whole new market for online games and start ups such as the Social Games Network (SGN) and Zynga. I wrote about developing Facebook Applications a while ago as a overview of my experiences. Some of my apps are games and some are not–I’m a game developer so I prefer making games.

While going through my blog traffic data, I saw search terms specifically about developing games on Facebook. That leads me to believe that someone is looking for information about that. I have some of that knowledge to share!

I generally make games for Facebook using Flash and ActionScript. There really isn’t a good way to make really interactive games using web languages and Flash is fairly powerful for 2D casual game experiences. You can find a list of the Facebook games that I’ve made or had a hand in from my developing Facebook Applications article.

There are basically three real games on that list: FlipCup Challenge, Sam’s Solitaire, and Sheep Tycoon. Sheep Tycoon is by far the prettiest because there was a real artist on that project–the other two I just slapped some art together to get the game out quickly. I’m not really an artist.

(more…)

Share/Bookmark

Sheep Tycoon

Author: Tommy Leung | 08.08.2008 | Category: Programming, Video Games



I had did some of the programming on this game for Facebook and now we’ve made a version of the game available for the general internet. The high scores for this version of the Facebook version will be different. I happen to hold the highest score on this version and the second highest on the Facebook version as I write this. Play it! :)
 

Share/Bookmark

AS3 KeyboardEvent

Author: Tommy Leung | 08.02.2008 | Category: Internet, Programming, Technology

I’ve been working with ActionScript 3 a little bit more as of late and one rather confusing problem that seems to come up often is one with KeyboardEvent–it doesn’t seem to always work. The solution that I’ve come up with is to always add the KeyboardEvent listener to the stage of the root.

So, you will want to use addEventListener in the main class:

stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp);

And that’s it! This way has worked well for me so far. I actually use a KeyManager class to initialize the events and the stage is passed to that class.

Share/Bookmark